* [PATCH -next] video: fbdev: imxfb: fix return value check in imxfb_probe()
@ 2022-07-29 2:41 Yang Yingliang
2022-07-29 20:59 ` Helge Deller
2022-07-30 23:18 ` Uwe Kleine-König
0 siblings, 2 replies; 4+ messages in thread
From: Yang Yingliang @ 2022-07-29 2:41 UTC (permalink / raw)
To: linux-kernel, linux-fbdev; +Cc: u.kleine-koenig, deller
If devm_ioremap_resource() fails, it never return NULL, replace
NULL test with IS_ERR().
Fixes: b083c22d5114 ("video: fbdev: imxfb: Convert request_mem_region + ioremap to devm_ioremap_resource")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/video/fbdev/imxfb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c
index c48477893dd0..d97d7456d15a 100644
--- a/drivers/video/fbdev/imxfb.c
+++ b/drivers/video/fbdev/imxfb.c
@@ -971,9 +971,9 @@ static int imxfb_probe(struct platform_device *pdev)
}
fbi->regs = devm_ioremap_resource(&pdev->dev, res);
- if (fbi->regs == NULL) {
+ if (IS_ERR(fbi->regs)) {
dev_err(&pdev->dev, "Cannot map frame buffer registers\n");
- ret = -ENOMEM;
+ ret = PTR_ERR(fbi->regs);
goto failed_ioremap;
}
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] video: fbdev: imxfb: fix return value check in imxfb_probe()
2022-07-29 2:41 [PATCH -next] video: fbdev: imxfb: fix return value check in imxfb_probe() Yang Yingliang
@ 2022-07-29 20:59 ` Helge Deller
2022-07-30 23:18 ` Uwe Kleine-König
1 sibling, 0 replies; 4+ messages in thread
From: Helge Deller @ 2022-07-29 20:59 UTC (permalink / raw)
To: Yang Yingliang, linux-kernel, linux-fbdev; +Cc: u.kleine-koenig
On 7/29/22 04:41, Yang Yingliang wrote:
> If devm_ioremap_resource() fails, it never return NULL, replace
> NULL test with IS_ERR().
>
> Fixes: b083c22d5114 ("video: fbdev: imxfb: Convert request_mem_region + ioremap to devm_ioremap_resource")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
applied to fbdev git tree.
Thanks!
Helge
> ---
> drivers/video/fbdev/imxfb.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c
> index c48477893dd0..d97d7456d15a 100644
> --- a/drivers/video/fbdev/imxfb.c
> +++ b/drivers/video/fbdev/imxfb.c
> @@ -971,9 +971,9 @@ static int imxfb_probe(struct platform_device *pdev)
> }
>
> fbi->regs = devm_ioremap_resource(&pdev->dev, res);
> - if (fbi->regs == NULL) {
> + if (IS_ERR(fbi->regs)) {
> dev_err(&pdev->dev, "Cannot map frame buffer registers\n");
> - ret = -ENOMEM;
> + ret = PTR_ERR(fbi->regs);
> goto failed_ioremap;
> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] video: fbdev: imxfb: fix return value check in imxfb_probe()
2022-07-29 2:41 [PATCH -next] video: fbdev: imxfb: fix return value check in imxfb_probe() Yang Yingliang
2022-07-29 20:59 ` Helge Deller
@ 2022-07-30 23:18 ` Uwe Kleine-König
2022-08-01 2:43 ` Yang Yingliang
1 sibling, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2022-07-30 23:18 UTC (permalink / raw)
To: Yang Yingliang; +Cc: linux-kernel, linux-fbdev, deller
[-- Attachment #1: Type: text/plain, Size: 521 bytes --]
Hello,
On Fri, Jul 29, 2022 at 10:41:34AM +0800, Yang Yingliang wrote:
> If devm_ioremap_resource() fails, it never return NULL, replace
> NULL test with IS_ERR().
Oh, thanks for cleanup up behind me. Did you find this using some static
analysis tool? I would consider it interesting and fair to mention this
in the commit log.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] video: fbdev: imxfb: fix return value check in imxfb_probe()
2022-07-30 23:18 ` Uwe Kleine-König
@ 2022-08-01 2:43 ` Yang Yingliang
0 siblings, 0 replies; 4+ messages in thread
From: Yang Yingliang @ 2022-08-01 2:43 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: linux-kernel, linux-fbdev, deller
Hi,
On 2022/7/31 7:18, Uwe Kleine-König wrote:
> Hello,
>
> On Fri, Jul 29, 2022 at 10:41:34AM +0800, Yang Yingliang wrote:
>> If devm_ioremap_resource() fails, it never return NULL, replace
>> NULL test with IS_ERR().
> Oh, thanks for cleanup up behind me. Did you find this using some static
> analysis tool? I would consider it interesting and fair to mention this
> in the commit log.
I found it by coccicheck like this:
@@
expression ret, E;
@@
ret = \(devm_ioremap_resource\)(...);
... when != ret = E
when != IS_ERR(ret)
(
ret == NULL || IS_ERR(ret)
|
IS_ERR(ret) || ret == NULL
|
ret != NULL && !IS_ERR(ret)
|
!IS_ERR(ret) && ret != NULL
|
- ret == NULL
+ IS_ERR(ret)
|
- ret != NULL
+ !IS_ERR(ret)
)
Thanks,
Yang
>
> Best regards
> Uwe
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-08-01 2:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-29 2:41 [PATCH -next] video: fbdev: imxfb: fix return value check in imxfb_probe() Yang Yingliang
2022-07-29 20:59 ` Helge Deller
2022-07-30 23:18 ` Uwe Kleine-König
2022-08-01 2:43 ` Yang Yingliang
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®