Skip to content

Commit 9bab71e

Browse files
author
Keith Busch
authored
Merge pull request #532 from simson-suse/master
nvme-vendor: fix c99 declarations in vendor plugins
2 parents 3a6072f + 507ded5 commit 9bab71e

3 files changed

Lines changed: 14 additions & 9 deletions

File tree

plugins/micron/micron-nvme.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ static int micron_selective_download(int argc, char **argv, struct command *cmd,
4040
void *fw_buf;
4141
int fd, selectNo,fw_fd,fw_size,err,offset = 0;
4242
struct stat sb;
43+
int i;
4344

4445
struct config {
4546
char *fw;
@@ -68,7 +69,7 @@ static int micron_selective_download(int argc, char **argv, struct command *cmd,
6869
goto out;
6970
}
7071

71-
for(int i=0;i<3;i++)
72+
for(i=0;i<3;i++)
7273
{
7374
cfg.select[i] = toupper(cfg.select[i]);
7475
}

plugins/toshiba/toshiba-nvme.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,11 @@ static int d_raw_to_fd(const unsigned char *buf, unsigned len, int fd)
192192
static void progress_runner(float progress)
193193
{
194194
const size_t barWidth = 70;
195+
size_t i;
195196

196197
fprintf(stdout, "[");
197198
size_t pos = barWidth * progress;
198-
for (size_t i = 0; i < barWidth; ++i) {
199+
for (i = 0; i < barWidth; ++i) {
199200
if (i <= pos) {
200201
fprintf(stdout, "=");
201202
} else {
@@ -216,6 +217,8 @@ static int nvme_get_internal_log(int fd, const char* const filename, bool curren
216217
// By trial and error it seems that the largest transfer chunk size
217218
// is 128 * 32 = 4k sectors = 2MB
218219
const __u32 max_pages = 128;
220+
size_t i;
221+
unsigned j;
219222
err = nvme_sct_command_transfer_log(fd, current);
220223
if (err) {
221224
fprintf(stderr, "%s: SCT command transfer failed\n", __func__);
@@ -267,7 +270,7 @@ static int nvme_get_internal_log(int fd, const char* const filename, bool curren
267270
}
268271
}
269272
// Now read the rest
270-
for (size_t i = 1; i < pages;) {
273+
for (i = 1; i < pages;) {
271274
__u32 pages_chunk = max_pages;
272275
if (pages_chunk + i >= pages) {
273276
pages_chunk = pages - i;
@@ -280,7 +283,7 @@ static int nvme_get_internal_log(int fd, const char* const filename, bool curren
280283
progress = (float) (i) / (float) (pages);
281284
progress_runner(progress);
282285
if (filename == NULL) {
283-
for (unsigned j = 0; j < pages_chunk; ++j) {
286+
for (j = 0; j < pages_chunk; ++j) {
284287
fprintf(stdout, "Page: %zu of %zu\n", i + j, pages);
285288
d(page_data + (j * page_data_len), page_data_len, 16, 1);
286289
}

plugins/wdc/wdc-nvme.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,6 +1312,7 @@ static int wdc_do_cap_dui(int fd, char *file, __u32 xfer_size, int data_area, in
13121312
__u64 buffer_addr;
13131313
__s64 total_size = 0;
13141314
int i;
1315+
int j;
13151316
bool last_xfer = false;
13161317
int err = 0, output = 0;
13171318

@@ -1349,13 +1350,13 @@ static int wdc_do_cap_dui(int fd, char *file, __u32 xfer_size, int data_area, in
13491350
} else {
13501351
/* parse log header for all sections up to specified data area inclusively */
13511352
if (data_area != WDC_NVME_DUI_MAX_DATA_AREA) {
1352-
for(int i = 0; i < WDC_NVME_DUI_MAX_SECTION_V2; i++) {
1353-
if (log_hdr_v2->log_section[i].data_area_id <= data_area &&
1354-
log_hdr_v2->log_section[i].data_area_id != 0) {
1355-
log_size += log_hdr_v2->log_section[i].section_size;
1353+
for(j = 0; j < WDC_NVME_DUI_MAX_SECTION_V2; j++) {
1354+
if (log_hdr_v2->log_section[j].data_area_id <= data_area &&
1355+
log_hdr_v2->log_section[j].data_area_id != 0) {
1356+
log_size += log_hdr_v2->log_section[j].section_size;
13561357
if (verbose)
13571358
fprintf(stderr, "%s: Data area ID %d : section size 0x%x, total size = 0x%lx\n",
1358-
__func__, log_hdr_v2->log_section[i].data_area_id, (unsigned int)log_hdr_v2->log_section[i].section_size, (long unsigned int)log_size);
1359+
__func__, log_hdr_v2->log_section[j].data_area_id, (unsigned int)log_hdr_v2->log_section[j].section_size, (long unsigned int)log_size);
13591360
}
13601361
else {
13611362
if (verbose)

0 commit comments

Comments
 (0)