* [PATCH] pinctrl: rtd: Fix error handling for devm_platform_ioremap_resource()
@ 2026-03-20 16:33 Felix Gu
2026-03-23 9:09 ` Yu-Chun Lin [林祐君]
0 siblings, 1 reply; 2+ messages in thread
From: Felix Gu @ 2026-03-20 16:33 UTC (permalink / raw)
To: Linus Walleij, Yu-Chun Lin; +Cc: linux-gpio, linux-kernel, Felix Gu
devm_platform_ioremap_resource() returns ERR_PTR() on failure,
not NULL. The incorrect NULL check would fail to detect actual
errors from the ioremap operation.
Fix by using IS_ERR() and PTR_ERR() as documented for this API.
Fixes: b7f698b22b8b ("pinctrl: realtek: Switch to use devm functions")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
drivers/pinctrl/realtek/pinctrl-rtd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/realtek/pinctrl-rtd.c b/drivers/pinctrl/realtek/pinctrl-rtd.c
index 60dfb39bc986..429c94b79c49 100644
--- a/drivers/pinctrl/realtek/pinctrl-rtd.c
+++ b/drivers/pinctrl/realtek/pinctrl-rtd.c
@@ -574,8 +574,8 @@ int rtd_pinctrl_probe(struct platform_device *pdev, const struct rtd_pinctrl_des
return -ENOMEM;
data->base = devm_platform_ioremap_resource(pdev, 0);
- if (!data->base)
- return -ENOMEM;
+ if (IS_ERR(data->base))
+ return PTR_ERR(data->base);
data->dev = &pdev->dev;
data->info = desc;
---
base-commit: b5d083a3ed1e2798396d5e491432e887da8d4a06
change-id: 20260321-rtd-ef9bf9f9cea7
Best regards,
--
Felix Gu <ustc.gu@gmail.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread* RE: [PATCH] pinctrl: rtd: Fix error handling for devm_platform_ioremap_resource()
2026-03-20 16:33 [PATCH] pinctrl: rtd: Fix error handling for devm_platform_ioremap_resource() Felix Gu
@ 2026-03-23 9:09 ` Yu-Chun Lin [林祐君]
0 siblings, 0 replies; 2+ messages in thread
From: Yu-Chun Lin [林祐君] @ 2026-03-23 9:09 UTC (permalink / raw)
To: Felix Gu, Linus Walleij
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
> -----Original Message-----
> From: Felix Gu <ustc.gu@gmail.com>
> Sent: Saturday, March 21, 2026 12:34 AM
> To: Linus Walleij <linusw@kernel.org>; Yu-Chun Lin [林祐君]
> <eleanor.lin@realtek.com>
> Cc: linux-gpio@vger.kernel.org; linux-kernel@vger.kernel.org; Felix Gu
> <ustc.gu@gmail.com>
> Subject: [PATCH] pinctrl: rtd: Fix error handling for
> devm_platform_ioremap_resource()
>
>
> External mail : This email originated from outside the organization. Do not
> reply, click links, or open attachments unless you recognize the sender and
> know the content is safe.
>
>
>
> devm_platform_ioremap_resource() returns ERR_PTR() on failure, not NULL.
> The incorrect NULL check would fail to detect actual errors from the ioremap
> operation.
>
> Fix by using IS_ERR() and PTR_ERR() as documented for this API.
>
> Fixes: b7f698b22b8b ("pinctrl: realtek: Switch to use devm functions")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>
> ---
> drivers/pinctrl/realtek/pinctrl-rtd.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pinctrl/realtek/pinctrl-rtd.c
> b/drivers/pinctrl/realtek/pinctrl-rtd.c
> index 60dfb39bc986..429c94b79c49 100644
> --- a/drivers/pinctrl/realtek/pinctrl-rtd.c
> +++ b/drivers/pinctrl/realtek/pinctrl-rtd.c
> @@ -574,8 +574,8 @@ int rtd_pinctrl_probe(struct platform_device *pdev,
> const struct rtd_pinctrl_des
> return -ENOMEM;
>
> data->base = devm_platform_ioremap_resource(pdev, 0);
> - if (!data->base)
> - return -ENOMEM;
> + if (IS_ERR(data->base))
> + return PTR_ERR(data->base);
>
> data->dev = &pdev->dev;
> data->info = desc;
>
> ---
> base-commit: b5d083a3ed1e2798396d5e491432e887da8d4a06
> change-id: 20260321-rtd-ef9bf9f9cea7
>
> Best regards,
> --
> Felix Gu <ustc.gu@gmail.com>
Hi Felix,
Thanks for the patch. However, a fix for this has already been applied.
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git/commit/?h=for-next&id=9ba4ef6847ba53dea92efce47c9e044fbf6d6dcf
Best Regards,
Yu-Chun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-23 9:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20 16:33 [PATCH] pinctrl: rtd: Fix error handling for devm_platform_ioremap_resource() Felix Gu
2026-03-23 9:09 ` Yu-Chun Lin [林祐君]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox