Skip to contentSkip to conversation

mmc: rtsx: add support for pre_req and post_req

DISCUSSION Dan Carpenter 2 participants 2 messages Feb 28, 2014 – Mar 3, 2014 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

Hello Micky Ching,

The patch c42deffd5b53: "mmc: rtsx: add support for pre_req and post_req" from Feb 17, 2014, leads to the following static checker warning:

	drivers/mmc/host/rtsx_pci_sdmmc.c:525 sd_pre_dma_transfer()
	warn: we tested 'next' before and it was 'false'

drivers/mmc/host/rtsx_pci_sdmmc.c
520 "error: invalid cookie data[%d] host[%d]\n",
521 data->host_cookie, host->next_data.cookie);
522 data->host_cookie = 0;
523 }
524
525 if (next || (!next && data->host_cookie != host->next_data.cookie))

                             ^^^^^

We are testing "next" twice. Often that means the intention was to test a different variable?

526 sg_count = rtsx_pci_dma_map_sg(pcr,
527 data->sg, data->sg_len, read);
528 else
529 sg_count = host->next_data.sg_count;

regards,
dan carpenter

#1 lore raw
Quoted 17 lines · Dan Carpenter

Hello Micky Ching,

The patch c42deffd5b53: "mmc: rtsx: add support for pre_req and post_req" from Feb 17, 2014, leads to the following static checker warning:

	drivers/mmc/host/rtsx_pci_sdmmc.c:525 sd_pre_dma_transfer()
	warn: we tested 'next' before and it was 'false'

drivers/mmc/host/rtsx_pci_sdmmc.c

    520                          "error: invalid cookie data[%d] host[%d]\n",
    521                          data->host_cookie, host->next_data.cookie);
    522                  data->host_cookie = 0;
    523          }
    524
    525          if (next || (!next && data->host_cookie != host->next_data.cookie))
                              ^^^^^
Quoted 2 lines

We are testing "next" twice. Often that means the intention was to test a different variable?

Yes, it can be write as follow.
if (next || data->host_cookie != host->next_data.cookie)

Quoted 9 lines
    526                  sg_count = rtsx_pci_dma_map_sg(pcr,
    527                                  data->sg, data->sg_len, read);
    528          else
    529                  sg_count = host->next_data.sg_count;

regards,
dan carpenter