Vishal Verma wrote:
> The json-c API json_object_new_uint64() is relatively new, and some distros
> may not have it available. There is already a wrapped version in
> util/json.h which falls back to the int64 API, based on meson's
> determination of the availability of the uint64 version at compile time.
> Replace the direct uint64 calls with this wrapped version.
> 
> Link: https://github.com/pmem/ndctl/issues/233
> Fixes: 8dedc6cf5e85 ("cxl: add a helper to parse trace events into a json 
> object")
> Reported-by: Michal Suchánek <msucha...@suse.de>
> Cc: Dave Jiang <dave.ji...@intel.com>
> Cc: Dan Williams <dan.j.willi...@intel.com>

Reviewed-by: Ira Weiny <ira.we...@intel.com>

> Signed-off-by: Vishal Verma <vishal.l.ve...@intel.com>
> ---
>  cxl/event_trace.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/cxl/event_trace.c b/cxl/event_trace.c
> index 926f446..db8cc85 100644
> --- a/cxl/event_trace.c
> +++ b/cxl/event_trace.c
> @@ -25,7 +25,7 @@ static struct json_object *num_to_json(void *num, int 
> elem_size, unsigned long f
>               if (sign)
>                       return json_object_new_int64(*(int64_t *)num);
>               else
> -                     return json_object_new_uint64(*(uint64_t *)num);
> +                     return util_json_new_u64(*(uint64_t *)num);
>       }
>  
>       /* All others fit in a signed 64 bit */
> @@ -98,7 +98,7 @@ static int cxl_event_to_json(struct tep_event *event, 
> struct tep_record *record,
>       }
>       json_object_object_add(jevent, "event", jobj);
>  
> -     jobj = json_object_new_uint64(record->ts);
> +     jobj = util_json_new_u64(record->ts);
>       if (!jobj) {
>               rc = -ENOMEM;
>               goto err_jevent;
> 
> -- 
> 2.39.1
> 



Reply via email to