Skip to content

Commit 74d5070

Browse files
benreese0keithbusch
authored andcommitted
Fixing Empty Fields of Intel VU id-ctrl
Fixing empty fields in Intel VU id-ctrl introduced in 44755ae. Signed-off-by: Ben Reese <[email protected]>
1 parent b662981 commit 74d5070

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

plugins/intel/intel-nvme.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static void json_intel_id_ctrl(struct nvme_vu_id_ctrl_field *id,
7676
struct json_object *root)
7777
{
7878
json_object_add_value_int(root, "ss", id->ss);
79-
json_object_add_value_string(root, "health", health[0] ? health : "healthy");
79+
json_object_add_value_string(root, "health", health );
8080
json_object_add_value_int(root, "cls", id->cls);
8181
json_object_add_value_int(root, "nlw", id->nlw);
8282
json_object_add_value_int(root, "scap", id->scap);
@@ -97,17 +97,30 @@ static void intel_id_ctrl(__u8 *vs, struct json_object *root)
9797
char mic_bl[5] = { 0 };
9898
char mic_fw[5] = { 0 };
9999

100+
101+
if (id->health[0]==0)
102+
{
103+
snprintf(health, 21, "%s", "healthy");
104+
}
105+
else
106+
{
107+
snprintf(health, 21, "%s", id->health);
108+
}
109+
110+
snprintf(bl, 9, "%s", id->bl);
100111
snprintf(ww, 19, "%02X%02X%02X%02X%02X%02X%02X%02X", id->ww[7],
101112
id->ww[6], id->ww[5], id->ww[4], id->ww[3], id->ww[2],
102113
id->ww[1], id->ww[0]);
114+
snprintf(mic_bl, 5, "%s", id->mic_bl);
115+
snprintf(mic_fw, 5, "%s", id->mic_fw);
103116

104117
if (root) {
105118
json_intel_id_ctrl(id, health, bl, ww, mic_bl, mic_fw, root);
106119
return;
107120
}
108121

109122
printf("ss : %d\n", id->ss);
110-
printf("health : %s\n", id->health[0] ? health : "healthy");
123+
printf("health : %s\n", health);
111124
printf("cls : %d\n", id->cls);
112125
printf("nlw : %d\n", id->nlw);
113126
printf("scap : %d\n", id->scap);

0 commit comments

Comments
 (0)