From: Dan Carpenter <dan.carpenter@linaro.org>
To: Shawn Lin <shawn.lin@rock-chips.com>
Cc: linux-mmc@vger.kernel.org
Subject: [bug report] mmc: dw_mmc: Remove struct dw_mci_slot
Date: Fri, 19 Dec 2025 11:17:19 +0300 [thread overview]
Message-ID: <aUUKD0YbuIIcK5pT@stanley.mountain> (raw)
Hello Shawn Lin,
Commit 926311cf3361 ("mmc: dw_mmc: Remove struct dw_mci_slot") from
Dec 16, 2025 (linux-next), leads to the following Smatch static
checker warning:
drivers/mmc/host/dw_mmc.c:3467 dw_mci_remove()
error: we previously assumed 'host' could be null (see line 3464)
drivers/mmc/host/dw_mmc.c
3457 return ret;
3458 }
3459 EXPORT_SYMBOL(dw_mci_probe);
3460
3461 void dw_mci_remove(struct dw_mci *host)
3462 {
3463 dev_dbg(host->dev, "remove host\n");
^^^^^^^^^
Host is dereferenced
3464 if (host)
Then checked for NULL.
3465 dw_mci_cleanup_host(host);
The dw_mci_cleanup_host() function gives up our claim to host which
allows it to be re-used.
3466
--> 3467 mci_writel(host, RINTSTS, 0xFFFFFFFF);
So it's surprising to me that we keep on using it throughout the
rest of the function.
3468 mci_writel(host, INTMASK, 0); /* disable all mmc interrupt first */
3469
3470 /* disable clock to CIU */
3471 mci_writel(host, CLKENA, 0);
3472 mci_writel(host, CLKSRC, 0);
3473
3474 if (host->use_dma && host->dma_ops->exit)
3475 host->dma_ops->exit(host);
3476
3477 reset_control_assert(host->pdata->rstc);
3478
3479 clk_disable_unprepare(host->ciu_clk);
3480 clk_disable_unprepare(host->biu_clk);
3481 }
regards,
dan carpenter
next reply other threads:[~2025-12-19 8:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-19 8:17 Dan Carpenter [this message]
2025-12-19 8:30 ` [bug report] mmc: dw_mmc: Remove struct dw_mci_slot Shawn Lin
-- strict thread matches above, loose matches on Subject: below --
2025-12-19 10:33 Dan Carpenter
2025-12-19 11:01 ` Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aUUKD0YbuIIcK5pT@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=linux-mmc@vger.kernel.org \
--cc=shawn.lin@rock-chips.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox