summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2020-11-17 09:13:50 +0300
committerThomas Zimmermann <tzimmermann@suse.de>2020-11-17 10:47:15 +0300
commitba236455ee750270f33998df57f982433cea4d8e (patch)
tree799b97461d83b55fa8e8d74f0b073e2343f8b405
parente9d2871f69212a5fb5a8c021dd0195cb502add44 (diff)
downloadlinux-ba236455ee750270f33998df57f982433cea4d8e.tar.xz
video: fbdev: atmel_lcdfb: fix return error code in atmel_lcdfb_of_init()
If devm_kzalloc() failed after the first time, atmel_lcdfb_of_init() can'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> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20201117061350.3453742-1-yangyingliang@huawei.com
-rw-r--r--drivers/video/fbdev/atmel_lcdfb.c2
1 files changed, 1 insertions, 1 deletions
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))