]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
video: ipuv3: Fix error handling when getting the display
authorMichal Suchanek <msuchanek@suse.de>
Wed, 12 Oct 2022 19:57:56 +0000 (21:57 +0200)
committerSimon Glass <sjg@chromium.org>
Tue, 18 Oct 2022 03:17:12 +0000 (21:17 -0600)
The code checks that uclass_first_device returned a device but the
returned value that is assigned is never used. Use
uclass_first_device_err instead, and move the error return outside of
the if block.

Fixes: f4ec1ae08e ("mxc_ipuv3_fb.c: call display_enable")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/video/imx/mxc_ipuv3_fb.c

index 49bbeefdd8e078a67bb6e039567550ff04e7b974..8b01a1be1129c7835f5b140c2b6453bcbc5ce6cb 100644 (file)
@@ -609,12 +609,11 @@ static int ipuv3_video_probe(struct udevice *dev)
                return ret;
 
 #if defined(CONFIG_DISPLAY)
-       ret = uclass_first_device(UCLASS_DISPLAY, &disp_dev);
-       if (disp_dev) {
+       ret = uclass_first_device_err(UCLASS_DISPLAY, &disp_dev);
+       if (!ret)
                ret = display_enable(disp_dev, 16, NULL);
-               if (ret < 0)
-                       return ret;
-       }
+       if (ret < 0)
+               return ret;
 #endif
        if (CONFIG_IS_ENABLED(PANEL)) {
                struct udevice *panel_dev;