From: Tokunori Ikegami Date: Sun, 1 Sep 2024 14:16:13 +0000 (+0900) Subject: ocp: fix ocp-nvme.c coding style errors X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e152e9715d4a289a9a5b4cda96ed875b7d997f6e;p=users%2Fsagi%2Fnvme-cli.git ocp: fix ocp-nvme.c coding style errors Only fixed some errors found by the file changes. Signed-off-by: Tokunori Ikegami --- diff --git a/plugins/ocp/ocp-nvme.c b/plugins/ocp/ocp-nvme.c index 57bb36b2..ef4e784e 100644 --- a/plugins/ocp/ocp-nvme.c +++ b/plugins/ocp/ocp-nvme.c @@ -912,6 +912,7 @@ __u8 *pC9_string_buffer; static void get_serial_number(struct nvme_id_ctrl *ctrl, char *sn) { int i; + /* Remove trailing spaces from the name */ for (i = 0; i < sizeof(ctrl->sn); i++) { if (ctrl->sn[i] == ' ') @@ -920,8 +921,7 @@ static void get_serial_number(struct nvme_id_ctrl *ctrl, char *sn) } } -static void print_telemetry_header(struct telemetry_initiated_log *logheader, - int tele_type) +static void print_telemetry_header(struct telemetry_initiated_log *logheader, int tele_type) { if (logheader) { unsigned int i = 0, j = 0; @@ -1610,22 +1610,21 @@ static int get_c9_log_page_data(struct nvme_dev *dev, int print_data, int save_b if (!ret) { log_data = (struct telemetry_str_log_format *)header_data; if (print_data) { - printf("Statistics Identifier String Table Size = %lld\n", - log_data->sitsz); + printf("Statistics Identifier String Table Size = %lld\n", log_data->sitsz); printf("Event String Table Size = %lld\n", log_data->estsz); printf("VU Event String Table Size = %lld\n", log_data->vu_eve_st_sz); printf("ASCII Table Size = %lld\n", log_data->asctsz); } - //Calculating the offset for dynamic fields. + /* Calculating the offset for dynamic fields. */ stat_id_str_table_ofst = log_data->sits * 4; event_str_table_ofst = log_data->ests * 4; vu_event_str_table_ofst = log_data->vu_eve_sts * 4; ascii_table_ofst = log_data->ascts * 4; total_log_page_sz = C9_TELEMETRY_STR_LOG_LEN + - (log_data->sitsz * 4) + (log_data->estsz * 4) + - (log_data->vu_eve_st_sz * 4) + (log_data->asctsz * 4); + (log_data->sitsz * 4) + (log_data->estsz * 4) + + (log_data->vu_eve_st_sz * 4) + (log_data->asctsz * 4); if (print_data) { printf("stat_id_str_table_ofst = %lld\n", stat_id_str_table_ofst); @@ -3589,9 +3588,7 @@ static void ocp_print_c9_log_binary(__u8 *log_data_buf, int total_log_page_size) static int get_c9_log_page(struct nvme_dev *dev, char *format) { - int ret = 0; - nvme_print_flags_t fmt; ret = validate_output_format(format, &fmt); @@ -3616,8 +3613,10 @@ static int get_c9_log_page(struct nvme_dev *dev, char *format) fprintf(stderr, "unhandled output format\n"); break; } - } else + } else { fprintf(stderr, "ERROR : OCP : Unable to read C9 data from buffer\n"); + } + free(header_data); return ret; }