* re: mmc: omap_hsmmc: Pin remux workaround to support SDIO interrupt on AM335x
@ 2016-03-17 17:32 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2016-03-17 17:32 UTC (permalink / raw)
To: afenkart; +Cc: linux-mmc, linux-omap
Hello Andreas Fenkart,
The patch 455e5cd6f736: "mmc: omap_hsmmc: Pin remux workaround to
support SDIO interrupt on AM335x" from May 29, 2014, leads to the
following static checker warning:
drivers/mmc/host/omap_hsmmc.c:1788 omap_hsmmc_configure_wake_irq()
error: 'p' dereferencing possible ERR_PTR()
drivers/mmc/host/omap_hsmmc.c
1780 if (host->pdata->controller_flags & OMAP_HSMMC_SWAKEUP_MISSING) {
1781 struct pinctrl *p = devm_pinctrl_get(host->dev);
^^^^^^^^^^^^^^^^^^^^^^^^^^
1782 if (!p) {
1783 ret = -ENODEV;
1784 goto err_free_irq;
1785 }
1786 if (IS_ERR(pinctrl_lookup_state(p, PINCTRL_STATE_DEFAULT))) {
1787 dev_info(host->dev, "missing default pinctrl state\n");
1788 devm_pinctrl_put(p);
^^^^^^^^^^^^^^^^^^^^
I believe that devm_pinctrl_get() only returns NULL when we are building
with COMPILE_TEST and not on bootable kernels.
This is an annoying thing, btw, because Smatch does cross function
analysis and I have to handle all these as a special case. "Whatever
function() returns ERR_PTR (and never NULL) in real life but NULL when
you are parsing the inline code." A lot of people do this or the
opposite and I can't see how it hels anyone, only how it hurts me.
And of course doing it all backwards depending leads to bugs like this.
1789 ret = -EINVAL;
1790 goto err_free_irq;
1791 }
1792
1793 if (IS_ERR(pinctrl_lookup_state(p, PINCTRL_STATE_IDLE))) {
1794 dev_info(host->dev, "missing idle pinctrl state\n");
1795 devm_pinctrl_put(p);
1796 ret = -EINVAL;
1797 goto err_free_irq;
1798 }
1799 devm_pinctrl_put(p);
1800 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-03-17 17:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-17 17:32 mmc: omap_hsmmc: Pin remux workaround to support SDIO interrupt on AM335x Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).