[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0724fac1-2dbb-480d-bd30-65755f86e148@amd.com>
Date: Mon, 10 Mar 2025 12:35:20 -0400
From: "Nirujogi, Pratap" <pnirujog@....com>
To: Dan Carpenter <dan.carpenter@...aro.org>,
Pratap Nirujogi <pratap.nirujogi@....com>
Cc: Linus Walleij <linus.walleij@...aro.org>, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
benjamin.chan@....com, bin.du@....com, gjorgji.rosikopulos@....com,
dominic.antony@....com
Subject: Re: [PATCH next] pinctrl: amd: isp411: Fix IS_ERR() vs NULL check in
probe()
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@...aro.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
>
Powered by blists - more mailing lists