All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Andreas Fenkart <afenkart@gmail.com>
Cc: linux-mmc@vger.kernel.org, Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH v3 1/1] mmc: omap_hsmmc: devm_pinctrl_get returns ERR_PTR upon error
Date: Wed, 20 Apr 2016 00:12:27 +0200	[thread overview]
Message-ID: <5784587.0IP58U3KN7@wuerfel> (raw)
In-Reply-To: <1461099853-15011-2-git-send-email-afenkart@gmail.com>

On Tuesday 19 April 2016 23:04:13 Andreas Fenkart wrote:
> Only the dummy implementation of devm_pinctrl_get returns NULL.
> The real implementation returns ERR_PTR. By enforcing pinselect
> in Kconfig we can simplify the test to check only for ERR_PTR.
> detected/triggered by static code checker.

This is not how the interface is meant to work:

The dummy devm_pinctrl_get() intentionally returns NULL because IS_ERR()
treats that as valid. All other pinctrl functions subsequently ignore
that NULL pointer, so the second half of the patch is ok without the
first half.

	Arnd

> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
> ---
>  drivers/mmc/host/Kconfig      | 1 +
>  drivers/mmc/host/omap_hsmmc.c | 4 ++--
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> index 1526b8a..b469755 100644
> --- a/drivers/mmc/host/Kconfig
> +++ b/drivers/mmc/host/Kconfig
> @@ -366,6 +366,7 @@ config MMC_OMAP
>  config MMC_OMAP_HS
>  	tristate "TI OMAP High Speed Multimedia Card Interface support"
>  	depends on HAS_DMA
> +	select PINCTRL
>  	depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || COMPILE_TEST
>  	help
>  	  This selects the TI OMAP High Speed Multimedia card Interface.
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 62e421a..15ebc3b 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -1842,8 +1842,8 @@ 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) {
> -			ret = -ENODEV;
> +		if (IS_ERR(p)) {
> +			ret = PTR_ERR(p);
>  			goto err_free_irq;
>  		}
>  		if (IS_ERR(pinctrl_lookup_state(p, PINCTRL_STATE_DEFAULT))) {
> 


  parent reply	other threads:[~2016-04-19 22:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19 21:04 [PATCH v3 0/1] mmc: omap_hsmmc: devm_pinctrl_get returns ERR_PTR Andreas Fenkart
2016-04-19 21:04 ` [PATCH v3 1/1] mmc: omap_hsmmc: devm_pinctrl_get returns ERR_PTR upon error Andreas Fenkart
2016-04-19 22:03   ` kbuild test robot
2016-04-19 22:12   ` Arnd Bergmann [this message]
2016-04-20  8:11     ` Dan Carpenter
2016-04-20 11:38       ` Andreas Fenkart
2016-04-20 15:13         ` Tony Lindgren
2016-04-20 22:28           ` Arnd Bergmann
2016-04-21  4:32             ` Dan Carpenter
2016-04-19 22:15   ` kbuild test robot
2016-04-19 22:19   ` kbuild test robot

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=5784587.0IP58U3KN7@wuerfel \
    --to=arnd@arndb.de \
    --cc=afenkart@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-mmc@vger.kernel.org \
    /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 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.