All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: omap_hsmmc: devm_pinctrl_get returns ERR_PTR upon error
@ 2016-03-20 22:55 Andreas Fenkart
  2016-03-21  8:41 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Fenkart @ 2016-03-20 22:55 UTC (permalink / raw)
  To: linux-mmc; +Cc: Dan Carpenter, Andreas Fenkart

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

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
---
 drivers/mmc/host/omap_hsmmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 62e421a..898878d 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -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;
 		}
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mmc: omap_hsmmc: devm_pinctrl_get returns ERR_PTR upon error
  2016-03-20 22:55 [PATCH] mmc: omap_hsmmc: devm_pinctrl_get returns ERR_PTR upon error Andreas Fenkart
@ 2016-03-21  8:41 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2016-03-21  8:41 UTC (permalink / raw)
  To: Andreas Fenkart; +Cc: linux-mmc

On Sun, Mar 20, 2016 at 11:55:04PM +0100, Andreas Fenkart wrote:
> devm_pinctrl_get returns NULL if CONFIG_PINCTRL is not set,
> returns ERR_PTR on error otherwise
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
> ---
>  drivers/mmc/host/omap_hsmmc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 62e421a..898878d 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-21  8:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-20 22:55 [PATCH] mmc: omap_hsmmc: devm_pinctrl_get returns ERR_PTR upon error Andreas Fenkart
2016-03-21  8:41 ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.