* [PATCH] video: fbdev: atmel_lcdfb: fixe return error code in atmel_lcdfb_of_init()
@ 2020-11-17 6:13 Yang Yingliang
2020-11-17 7:41 ` Thomas Zimmermann
0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2020-11-17 6:13 UTC (permalink / raw)
To: linux-fbdev, linux-kernel; +Cc: b.zolnierkie, yangyingliang
If devm_kzalloc() failed after first time, atmel_lcdfb_of_init()
cann't return -ENOMEM, fix this by putting the error code in loop.
Fixes: b985172b328a ("video: atmel_lcdfb: add device tree suport")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/video/fbdev/atmel_lcdfb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c
index 8c1d47e52b1a..355b6120dc4f 100644
--- a/drivers/video/fbdev/atmel_lcdfb.c
+++ b/drivers/video/fbdev/atmel_lcdfb.c
@@ -987,8 +987,8 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
}
INIT_LIST_HEAD(&pdata->pwr_gpios);
- ret = -ENOMEM;
for (i = 0; i < gpiod_count(dev, "atmel,power-control"); i++) {
+ ret = -ENOMEM;
gpiod = devm_gpiod_get_index(dev, "atmel,power-control",
i, GPIOD_ASIS);
if (IS_ERR(gpiod))
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] video: fbdev: atmel_lcdfb: fixe return error code in atmel_lcdfb_of_init()
2020-11-17 6:13 [PATCH] video: fbdev: atmel_lcdfb: fixe return error code in atmel_lcdfb_of_init() Yang Yingliang
@ 2020-11-17 7:41 ` Thomas Zimmermann
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Zimmermann @ 2020-11-17 7:41 UTC (permalink / raw)
To: Yang Yingliang, linux-fbdev, linux-kernel; +Cc: b.zolnierkie
Hi
Am 17.11.20 um 07:13 schrieb Yang Yingliang:
> If devm_kzalloc() failed after first time, atmel_lcdfb_of_init()
> cann't return -ENOMEM, fix this by putting the error code in loop.
>
> Fixes: b985172b328a ("video: atmel_lcdfb: add device tree suport")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> drivers/video/fbdev/atmel_lcdfb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c
> index 8c1d47e52b1a..355b6120dc4f 100644
> --- a/drivers/video/fbdev/atmel_lcdfb.c
> +++ b/drivers/video/fbdev/atmel_lcdfb.c
> @@ -987,8 +987,8 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
> }
>
> INIT_LIST_HEAD(&pdata->pwr_gpios);
> - ret = -ENOMEM;
> for (i = 0; i < gpiod_count(dev, "atmel,power-control"); i++) {
> + ret = -ENOMEM;
I think that a better fix would have been to put it into the alloc's
error branch. But anyway
Reviewed-by: Thomas Zimmermann <tzimmremann@suse.de>
Thanks for your patch. I'll add it to drm-misc-next.
Best regards
Thomas
> gpiod = devm_gpiod_get_index(dev, "atmel,power-control",
> i, GPIOD_ASIS);
> if (IS_ERR(gpiod))
>
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-17 7:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17 6:13 [PATCH] video: fbdev: atmel_lcdfb: fixe return error code in atmel_lcdfb_of_init() Yang Yingliang
2020-11-17 7:41 ` Thomas Zimmermann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).