Skip to contentSkip to conversation

mmc: omap_hsmmc: devm_pinctrl_get returns ERR_PTR upon error

PATCH Superseded Andreas Fenkart 2 participants 2 messages Mar 20, 2016 – Mar 21, 2016

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: omap_hsmmc: devm_pinctrl_get returns ERR_PTR upon error

devm_pinctrl_get returns NULL if CONFIG_PINCTRL is not set, returns ERR_PTR on error otherwise

---
 drivers/mmc/host/omap_hsmmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/omap_hsmmc.c +1 -1
index 62e421a..898878d 100644
@@ -1842,7 +1842,7 @@ static int omap_hsmmc_configure_wake_irq(struct omap_hsmmc_host *host)
 	 */
 	if (host->pdata->controller_flags & OMAP_HSMMC_SWAKEUP_MISSING) {
 		struct pinctrl *p = devm_pinctrl_get(host->dev);
-		if (!p) {
+		if (!p || IS_ERR(p)) {
 			ret = -ENODEV;
 			goto err_free_irq;
 		}
Signature · 1 line
2.7.0
#1 lore raw
Quoted 14 lines · Andreas Fenkart

devm_pinctrl_get returns NULL if CONFIG_PINCTRL is not set, returns ERR_PTR on error otherwise

---
 drivers/mmc/host/omap_hsmmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/omap_hsmmc.c +0 -0
index 62e421a..898878d 100644

drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_configure_wake_irq(struct omap_hsmmc_host *host) · line 1846

Quoted 6 lines
drivers/mmc/host/omap_hsmmc.c +1 -1
@@ -1842,7 +1842,7 @@ static int omap_hsmmc_configure_wake_irq(struct omap_hsmmc_host *host)
 	 */
 	if (host->pdata->controller_flags & OMAP_HSMMC_SWAKEUP_MISSING) {
 		struct pinctrl *p = devm_pinctrl_get(host->dev);
-		if (!p) {
+		if (!p || IS_ERR(p)) {
 			ret = -ENODEV;

I think I know why it returns NULL with pinctrl disabled, it's not because of COMPILE_TEST as I said before. The reason is that it's not supposed to be treated as an error if we turn off that config. In other words, the person configuring the kernel wanted it to just boot here. If it's not possible to boot then instead of checking for NULL we should make it impossible to compile without PINCTRL by setting that in the Kconfig.

It may be that the Kconfig already force you to have PINCTRL. ARCH_OMAP2PLUS does, but I'm not sure about ARCH_KEYSTONE.

So the check for NULL should be removed and also we should preserve the error code.

	if (IS_ERR(p)) {
		ret = PTR_ERR(p);

regards,
dan carpenter