]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
video: Check return value in pwm_backlight_of_to_plat()
authorSimon Glass <sjg@chromium.org>
Fri, 14 May 2021 01:39:18 +0000 (19:39 -0600)
committerTom Rini <trini@konsulko.com>
Thu, 15 Jul 2021 22:42:05 +0000 (18:42 -0400)
This cannot actually fail, but check the value anyway to keep coverity
happy.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 316351)
drivers/video/pwm_backlight.c

index 4c86215bd73e57c29883fe9e6ff976f229eb5f8a..d7c096923b37288adc6ed450e036fe456ae4b07b 100644 (file)
@@ -235,8 +235,10 @@ static int pwm_backlight_of_to_plat(struct udevice *dev)
                priv->levels = malloc(len);
                if (!priv->levels)
                        return log_ret(-ENOMEM);
-               dev_read_u32_array(dev, "brightness-levels", priv->levels,
-                                  count);
+               ret = dev_read_u32_array(dev, "brightness-levels", priv->levels,
+                                        count);
+               if (ret)
+                       return log_msg_ret("levels", ret);
                priv->num_levels = count;
                priv->default_level = priv->levels[index];
                priv->max_level = priv->levels[count - 1];