Re: [PATCH v5 07/15] video: ipuv3: Fix error handling when getting the display

2022-09-29 Thread Simon Glass
On Tue, 27 Sept 2022 at 15:38, Michal Suchanek  wrote:
>
> 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 
> ---
>  drivers/video/imx/mxc_ipuv3_fb.c | 9 -
>  1 file changed, 4 insertions(+), 5 deletions(-)

Reviewed-by: Simon Glass 


[PATCH v5 07/15] video: ipuv3: Fix error handling when getting the display

2022-09-27 Thread Michal Suchanek
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 
---
 drivers/video/imx/mxc_ipuv3_fb.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/video/imx/mxc_ipuv3_fb.c b/drivers/video/imx/mxc_ipuv3_fb.c
index 49bbeefdd8..8b01a1be11 100644
--- a/drivers/video/imx/mxc_ipuv3_fb.c
+++ b/drivers/video/imx/mxc_ipuv3_fb.c
@@ -609,12 +609,11 @@ static int ipuv3_video_probe(struct udevice *dev)
return ret;
 
 #if defined(CONFIG_DISPLAY)
-   ret = uclass_first_device(UCLASS_DISPLAY, _dev);
-   if (disp_dev) {
+   ret = uclass_first_device_err(UCLASS_DISPLAY, _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;
-- 
2.37.3