Skip to contentSkip to conversation

mmc: dw_mmc: rework the code related to cmd/data completion

DISCUSSION Dan Carpenter 2 participants 2 messages Nov 6, 2013 – Nov 7, 2013 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

Hello Seungwon Jeon,

This is a semi-automatic email about new static checker warnings.

The patch e352c8131100: "mmc: dw_mmc: rework the code related to cmd/data completion" from Aug 31, 2013, leads to the following Smatch complaint:

drivers/mmc/host/dw_mmc.c:1339 dw_mci_tasklet_func()

	 error: we previously assumed 'data->stop' could be null (see line 1337)

drivers/mmc/host/dw_mmc.c
1336 if (!err) {

  1337					if (!data->stop || mrq->sbc) {
                                             ^^^^^^^^^^

New check.

1338 if (mrq->sbc)

  1339							data->stop->error = 0;
                                                        ^^^^^^^^^^

New unchecked dereference. Should the check be "if (data->stop)" instead of "if (mrq->sbc)"?

  1340						dw_mci_request_end(host, mrq);
  1341						goto unlock;

regards,
dan carpenter

#1 lore raw

Hi Dan Carpenter,

Quoted 15 lines · Dan Carpenter

Hello Seungwon Jeon,

This is a semi-automatic email about new static checker warnings.

The patch e352c8131100: "mmc: dw_mmc: rework the code related to cmd/data completion" from Aug 31, 2013, leads to the following Smatch complaint:

drivers/mmc/host/dw_mmc.c:1339 dw_mci_tasklet_func()

	 error: we previously assumed 'data->stop' could be null (see line 1337)

drivers/mmc/host/dw_mmc.c
1336 if (!err) {

  1337					if (!data->stop || mrq->sbc) {
                                             ^^^^^^^^^^
Quoted 7 lines

New check.

1338 if (mrq->sbc)

  1339							data->stop->error = 0;
                                                        ^^^^^^^^^^

New unchecked dereference. Should the check be "if (data->stop)" instead of "if (mrq->sbc)"?

It assumes that Upper layer sets all together. Actually, it does. If 'mrq->sbc' is valid, it means that 'data->stop' must be also valid. But if '&& data->stop' condition is added , it would be certain. Ok. Thank you for report.

Thanks,
Seungwon Jeon.