Skip to contentSkip to conversation

mmc: dw_mmc: Remove struct dw_mci_slot

bug report Dan Carpenter 2 participants 2 messages Dec 19, 2025 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

[ Sorry, a couple more. I should have included these in the same email ]

Hello Shawn Lin,

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

Commit 926311cf3361 ("mmc: dw_mmc: Remove struct dw_mci_slot") from Dec 16, 2025, leads to the following Smatch complaint:

drivers/mmc/host/dw_mmc.c:3494 dw_mci_runtime_suspend() warn: variable dereferenced before check 'host' (see line 3489) drivers/mmc/host/dw_mmc.c:3546 dw_mci_runtime_resume() warn: variable dereferenced before check 'host' (see line 3516) drivers/mmc/host/dw_mmc.c:3562 dw_mci_runtime_resume() warn: variable dereferenced before check 'host' (see line 3516)

drivers/mmc/host/dw_mmc.c
3488
3489 if (host->use_dma && host->dma_ops->exit)

                    ^^^^^^

The host pointer is dereferenced

3490 host->dma_ops->exit(host);
3491
3492 clk_disable_unprepare(host->ciu_clk);
3493
3494 if (host &&

                    ^^^^

So this check is too late.

3495 (mmc_host_can_gpio_cd(host->mmc) ||
3496 !mmc_card_is_removable(host->mmc)))

regards,
dan carpenter

#1 lore raw
Quoted 25 lines · Dan Carpenter

[ Sorry, a couple more. I should have included these in the same email ]

Hello Shawn Lin,

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

Commit 926311cf3361 ("mmc: dw_mmc: Remove struct dw_mci_slot") from Dec 16, 2025, leads to the following Smatch complaint:

drivers/mmc/host/dw_mmc.c:3494 dw_mci_runtime_suspend() warn: variable dereferenced before check 'host' (see line 3489) drivers/mmc/host/dw_mmc.c:3546 dw_mci_runtime_resume() warn: variable dereferenced before check 'host' (see line 3516) drivers/mmc/host/dw_mmc.c:3562 dw_mci_runtime_resume() warn: variable dereferenced before check 'host' (see line 3516)

drivers/mmc/host/dw_mmc.c
3488
3489 if (host->use_dma && host->dma_ops->exit)

                    ^^^^^^

The host pointer is dereferenced

3490 host->dma_ops->exit(host);
3491
3492 clk_disable_unprepare(host->ciu_clk);
3493
3494 if (host &&

Quoted 9 lines
                    ^^^^

So this check is too late.

3495 (mmc_host_can_gpio_cd(host->mmc) ||
3496 !mmc_card_is_removable(host->mmc)))

regards,
dan carpenter

Thanks for reporting Dan, the offending commit has just been dropped from my next branch.

Kind regards
Uffe