Skip to contentSkip to conversation

drm/panel: Fix return value check in nt35950_probe()

PATCH In review Lu Wei 3 participants 3 messages Mar 17, 2022

Subsystems (3)
lore
Share & tools
lore

Lu Wei

author
#0 lore raw

PATCH v2 1/1 drm/panel: Fix return value check in nt35950_probe()

In function nt35950_probe(), mipi_dsi_device_register_full() is called to create a MIPI DSI device. If it fails, a pointer encoded with an error will be returned, so use IS_ERR() to check the return value. Besides, use PTR_ERR to return the actual errno.

Fixes 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC panels")
---
 drivers/gpu/drm/panel/panel-novatek-nt35950.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-novatek-nt35950.c +2 -2
index 288c7fa83ecc..d252e5e56228 100644
@@ -579,9 +579,9 @@ static int nt35950_probe(struct mipi_dsi_device *dsi)
 		}
 
 		nt->dsi[1] = mipi_dsi_device_register_full(dsi_r_host, info);
-		if (!nt->dsi[1]) {
+		if (IS_ERR(nt->dsi[1])) {
 			dev_err(dev, "Cannot get secondary DSI node\n");
-			return -ENODEV;
+			return PTR_ERR(nt->dsi[1]);
 		}
 		num_dsis++;
 	}
Signature · 1 line
2.17.1
Reviewed-by on v2 1/1
#1 lore raw

Il 17/03/22 09:37, Lu Wei ha scritto:

Quoted 7 lines

In function nt35950_probe(), mipi_dsi_device_register_full() is called to create a MIPI DSI device. If it fails, a pointer encoded with an error will be returned, so use IS_ERR() to check the return value. Besides, use PTR_ERR to return the actual errno.

Fixes 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC panels")

Thanks!

Quoted 20 lines
---
  drivers/gpu/drm/panel/panel-novatek-nt35950.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-novatek-nt35950.c +2 -2
index 288c7fa83ecc..d252e5e56228 100644
@@ -579,9 +579,9 @@ static int nt35950_probe(struct mipi_dsi_device *dsi)
  		}
 
  		nt->dsi[1] = mipi_dsi_device_register_full(dsi_r_host, info);
-		if (!nt->dsi[1]) {
+		if (IS_ERR(nt->dsi[1])) {
  			dev_err(dev, "Cannot get secondary DSI node\n");
-			return -ENODEV;
+			return PTR_ERR(nt->dsi[1]);
  		}
  		num_dsis++;
  	}
Acked-by on v2 1/1
#2 lore raw
In reply to Lu Wei
Quoted 7 lines · Lu Wei

In function nt35950_probe(), mipi_dsi_device_register_full() is called to create a MIPI DSI device. If it fails, a pointer encoded with an error will be returned, so use IS_ERR() to check the return value. Besides, use PTR_ERR to return the actual errno.

Fixes 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC panels")