Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: "Nirujogi, Pratap" <pnirujog@amd.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
	Pratap Nirujogi <pratap.nirujogi@amd.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org, benjamin.chan@amd.com,
	bin.du@amd.com, gjorgji.rosikopulos@amd.com,
	dominic.antony@amd.com
Subject: Re: [PATCH next] pinctrl: amd: isp411: Fix IS_ERR() vs NULL check in probe()
Date: Mon, 10 Mar 2025 12:35:20 -0400	[thread overview]
Message-ID: <0724fac1-2dbb-480d-bd30-65755f86e148@amd.com> (raw)
In-Reply-To: <617f4c77-7837-4e24-9f4d-620ecfedf924@stanley.mountain>

Hi Dan,

Thanks for the fix. I have missed earlier that PTR_ERR() casts NULL to 
0, which kernel treats it as success and not valid in this case.

Thanks,
Pratap


On 3/10/2025 6:52 AM, Dan Carpenter wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> 
> 
> The platform_get_resource() returns NULL on error.  It doesn't
> return error pointers.  Fix the error checking to match.
> 
> Fixes: e97435ab09f3 ("pinctrl: amd: isp411: Add amdisp GPIO pinctrl")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>   drivers/pinctrl/pinctrl-amdisp.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-amdisp.c b/drivers/pinctrl/pinctrl-amdisp.c
> index ce21ed84b929..9256ed67bb20 100644
> --- a/drivers/pinctrl/pinctrl-amdisp.c
> +++ b/drivers/pinctrl/pinctrl-amdisp.c
> @@ -183,8 +183,8 @@ static int amdisp_pinctrl_probe(struct platform_device *pdev)
>          pdev->dev.init_name = DRV_NAME;
> 
>          res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -       if (IS_ERR(res))
> -               return PTR_ERR(res);
> +       if (!res)
> +               return -EINVAL;
> 
>          pctrl->gpiobase = devm_ioremap_resource(&pdev->dev, res);
>          if (IS_ERR(pctrl->gpiobase))
> --
> 2.47.2
> 


  reply	other threads:[~2025-03-10 16:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-10 10:52 [PATCH next] pinctrl: amd: isp411: Fix IS_ERR() vs NULL check in probe() Dan Carpenter
2025-03-10 16:35 ` Nirujogi, Pratap [this message]
2025-03-11 15:05   ` Nirujogi, Pratap
2025-03-14 10:34 ` Linus Walleij

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=0724fac1-2dbb-480d-bd30-65755f86e148@amd.com \
    --to=pnirujog@amd.com \
    --cc=benjamin.chan@amd.com \
    --cc=bin.du@amd.com \
    --cc=dan.carpenter@linaro.org \
    --cc=dominic.antony@amd.com \
    --cc=gjorgji.rosikopulos@amd.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pratap.nirujogi@amd.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