lkml.org 
[lkml]   [2020]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 2/3] gpio: pxa: Fix return value of pxa_gpio_probe()
Date
Tiezhu Yang <yangtiezhu@loongson.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@loongson.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

\
 
 \ /
  Last update: 2020-05-22 21:09    [W:0.072 / U:0.880 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site