[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <874ks7okk4.fsf@belgarion.home>
Date: Fri, 22 May 2020 21:07:23 +0200
From: Robert Jarzmik <robert.jarzmik@...e.fr>
To: Tiezhu Yang <yangtiezhu@...ngson.cn>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
Ray Jui <rjui@...adcom.com>,
bcm-kernel-feedback-list@...adcom.com, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org, Xuefeng Li <lixuefeng@...ngson.cn>
Subject: Re: [PATCH 2/3] gpio: pxa: Fix return value of pxa_gpio_probe()
Tiezhu Yang <yangtiezhu@...ngson.cn> writes:
> When call function devm_platform_ioremap_resource(), we should use IS_ERR()
> to check the return value and return PTR_ERR() if failed.
>
> Fixes: 542c25b7a209 ("drivers: gpio: pxa: use devm_platform_ioremap_resource()")
> Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
> ---
> drivers/gpio/gpio-pxa.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
> index 1361270..0cb6600 100644
> --- a/drivers/gpio/gpio-pxa.c
> +++ b/drivers/gpio/gpio-pxa.c
> @@ -660,8 +660,8 @@ static int pxa_gpio_probe(struct platform_device *pdev)
> pchip->irq1 = irq1;
>
> gpio_reg_base = devm_platform_ioremap_resource(pdev, 0);
> - if (!gpio_reg_base)
> - return -EINVAL;
> + if (IS_ERR(gpio_reg_base))
> + return PTR_ERR(gpio_reg_base);
As far as I know, devm_platform_ioremap_resource() could return NULL which is
not handled by this test (unless __devm_ioremap() semantics changed since I had
a look).
Therefore, this patch is incorrect, or rather incomplete.
Cheers.
--
Robert
Powered by blists - more mailing lists