* [PATCH] resource: replace wrong NULL check for dev_get_resource_by_name with IS_ERR
@ 2025-05-06 6:21 Ahmad Fatoum
2025-05-06 7:23 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-05-06 6:21 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
On error, dev_get_resource_by_name returns an error pointer, but a NULL
pointer was assumed instead erroneously.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/gpio/gpio-generic.c | 2 +-
drivers/video/rockchip/rockchip_drm_vop2.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
index 1902c8396094..6164e87073bd 100644
--- a/drivers/gpio/gpio-generic.c
+++ b/drivers/gpio/gpio-generic.c
@@ -538,7 +538,7 @@ static int bgpio_dev_probe(struct device *dev)
return PTR_ERR(pdata);
r = dev_get_resource_by_name(dev, IORESOURCE_MEM, "dat");
- if (!r)
+ if (IS_ERR(r))
return -EINVAL;
sz = resource_size(r);
diff --git a/drivers/video/rockchip/rockchip_drm_vop2.c b/drivers/video/rockchip/rockchip_drm_vop2.c
index 0d6d31a86804..b49053c6e915 100644
--- a/drivers/video/rockchip/rockchip_drm_vop2.c
+++ b/drivers/video/rockchip/rockchip_drm_vop2.c
@@ -1958,7 +1958,7 @@ int vop2_bind(struct device *dev)
vop2->data = vop2_data;
res = dev_get_resource_by_name(dev, IORESOURCE_MEM, "vop");
- if (!res)
+ if (IS_ERR(res))
return dev_err_probe(vop2->dev, -EINVAL, "failed to get vop2 register byname\n");
vop2->regs = IOMEM(res->start);
--
2.39.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] resource: replace wrong NULL check for dev_get_resource_by_name with IS_ERR
2025-05-06 6:21 [PATCH] resource: replace wrong NULL check for dev_get_resource_by_name with IS_ERR Ahmad Fatoum
@ 2025-05-06 7:23 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-05-06 7:23 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Tue, 06 May 2025 08:21:59 +0200, Ahmad Fatoum wrote:
> On error, dev_get_resource_by_name returns an error pointer, but a NULL
> pointer was assumed instead erroneously.
>
>
Applied, thanks!
[1/1] resource: replace wrong NULL check for dev_get_resource_by_name with IS_ERR
https://git.pengutronix.de/cgit/barebox/commit/?id=16f93a2397b2 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-05-06 7:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-06 6:21 [PATCH] resource: replace wrong NULL check for dev_get_resource_by_name with IS_ERR Ahmad Fatoum
2025-05-06 7:23 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox