Change the variable type for storing result of life used field accessor : u32 to int. Fix the value for checking device's life used field is implemented.
Signed-off-by: Jehoon Park <[email protected]> --- cxl/json.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cxl/json.c b/cxl/json.c index 89e5fd0..102bfaf 100644 --- a/cxl/json.c +++ b/cxl/json.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 // Copyright (C) 2015-2021 Intel Corporation. All rights reserved. +#include <errno.h> #include <limits.h> #include <util/json.h> #include <uuid/uuid.h> @@ -238,9 +239,9 @@ static struct json_object *util_cxl_memdev_health_to_json( json_object_object_add(jhealth, "ext_corrected_persistent", jobj); /* other fields */ - field = cxl_cmd_health_info_get_life_used(cmd); - if (field != 0xff) { - jobj = json_object_new_int(field); + rc = cxl_cmd_health_info_get_life_used(cmd); + if (rc != -EOPNOTSUPP) { + jobj = json_object_new_int(rc); if (jobj) json_object_object_add(jhealth, "life_used_percent", jobj); } -- 2.17.1
