diff mbox series

drm/panel: novatek-nt35950: fix return value check in nt35950_probe()

Message ID 20241029123957.1588-1-yangyingliang@huaweicloud.com (mailing list archive)
State New, archived
Headers show
Series drm/panel: novatek-nt35950: fix return value check in nt35950_probe() | expand

Commit Message

Yang Yingliang Oct. 29, 2024, 12:39 p.m. UTC
From: Yang Yingliang <yangyingliang@huawei.com>

mipi_dsi_device_register_full() never returns NULL pointer, it
will return ERR_PTR() when it fails, so replace the check with
IS_ERR().

Fixes: 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC panels")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/gpu/drm/panel/panel-novatek-nt35950.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Neil Armstrong Nov. 4, 2024, 8:38 a.m. UTC | #1
On 29/10/2024 13:39, Yang Yingliang wrote:
> From: Yang Yingliang <yangyingliang@huawei.com>
> 
> mipi_dsi_device_register_full() never returns NULL pointer, it
> will return ERR_PTR() when it fails, so replace the check with
> IS_ERR().
> 
> Fixes: 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC panels")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>   drivers/gpu/drm/panel/panel-novatek-nt35950.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
> index b036208f9356..08b22b592ab0 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
> @@ -481,9 +481,9 @@ static int nt35950_probe(struct mipi_dsi_device *dsi)
>   			return dev_err_probe(dev, -EPROBE_DEFER, "Cannot get secondary DSI host\n");
>   
>   		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++;
>   	}

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Neil Armstrong Dec. 13, 2024, 9:56 a.m. UTC | #2
Hi,

On Tue, 29 Oct 2024 20:39:57 +0800, Yang Yingliang wrote:
> mipi_dsi_device_register_full() never returns NULL pointer, it
> will return ERR_PTR() when it fails, so replace the check with
> IS_ERR().
> 
> 

Thanks, Applied to https://gitlab.freedesktop.org/drm/misc/kernel.git (drm-misc-fixes)

[1/1] drm/panel: novatek-nt35950: fix return value check in nt35950_probe()
      https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/f8fd0968eff52cf092c0d517d17507ea2f6e5ea5
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
index b036208f9356..08b22b592ab0 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
@@ -481,9 +481,9 @@  static int nt35950_probe(struct mipi_dsi_device *dsi)
 			return dev_err_probe(dev, -EPROBE_DEFER, "Cannot get secondary DSI host\n");
 
 		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++;
 	}