* [PATCH] char: xilinx_hwicap: Fix NULL vs IS_ERR() bug
@ 2024-02-20 9:02 Dan Carpenter
2024-02-20 9:59 ` Michal Simek
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2024-02-20 9:02 UTC (permalink / raw)
To: Rob Herring
Cc: Arnd Bergmann, Greg Kroah-Hartman, Michal Simek,
Uwe Kleine-König, Benjamin Tissoires, Ivan Orlov,
linux-arm-kernel, linux-kernel, kernel-janitors
The devm_platform_ioremap_resource() function returns error pointers.
It never returns NULL. Update the check accordingly.
Fixes: 672371832193 ("char: xilinx_hwicap: Modernize driver probe")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/char/xilinx_hwicap/xilinx_hwicap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 019cf6079cec..6d2eadefd9dc 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -639,8 +639,8 @@ static int hwicap_setup(struct platform_device *pdev, int id,
dev_set_drvdata(dev, (void *)drvdata);
drvdata->base_address = devm_platform_ioremap_resource(pdev, 0);
- if (!drvdata->base_address) {
- retval = -ENODEV;
+ if (IS_ERR(drvdata->base_address)) {
+ retval = PTR_ERR(drvdata->base_address);
goto failed;
}
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] char: xilinx_hwicap: Fix NULL vs IS_ERR() bug
2024-02-20 9:02 [PATCH] char: xilinx_hwicap: Fix NULL vs IS_ERR() bug Dan Carpenter
@ 2024-02-20 9:59 ` Michal Simek
0 siblings, 0 replies; 2+ messages in thread
From: Michal Simek @ 2024-02-20 9:59 UTC (permalink / raw)
To: Dan Carpenter, Rob Herring
Cc: Arnd Bergmann, Greg Kroah-Hartman, Uwe Kleine-König,
Benjamin Tissoires, Ivan Orlov, linux-arm-kernel, linux-kernel,
kernel-janitors
On 2/20/24 10:02, Dan Carpenter wrote:
> The devm_platform_ioremap_resource() function returns error pointers.
> It never returns NULL. Update the check accordingly.
>
> Fixes: 672371832193 ("char: xilinx_hwicap: Modernize driver probe")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/char/xilinx_hwicap/xilinx_hwicap.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> index 019cf6079cec..6d2eadefd9dc 100644
> --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> @@ -639,8 +639,8 @@ static int hwicap_setup(struct platform_device *pdev, int id,
> dev_set_drvdata(dev, (void *)drvdata);
>
> drvdata->base_address = devm_platform_ioremap_resource(pdev, 0);
> - if (!drvdata->base_address) {
> - retval = -ENODEV;
> + if (IS_ERR(drvdata->base_address)) {
> + retval = PTR_ERR(drvdata->base_address);
> goto failed;
> }
>
Acked-by: Michal Simek <michal.simek@amd.com>
Thanks,
Michal
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-20 9:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-20 9:02 [PATCH] char: xilinx_hwicap: Fix NULL vs IS_ERR() bug Dan Carpenter
2024-02-20 9:59 ` Michal Simek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®