From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] resource: replace wrong NULL check for dev_get_resource_by_name with IS_ERR
Date: Tue, 6 May 2025 08:21:59 +0200 [thread overview]
Message-ID: <20250506062159.3091243-1-a.fatoum@pengutronix.de> (raw)
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
next reply other threads:[~2025-05-06 6:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-06 6:21 Ahmad Fatoum [this message]
2025-05-06 7:23 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250506062159.3091243-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox