diff mbox series

drm/panel: nt36523: fix return value check in nt36523_probe()

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

Commit Message

Yang Yingliang Nov. 29, 2023, 9:07 a.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: 0993234a0045 ("drm/panel: Add driver for Novatek NT36523")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/gpu/drm/panel/panel-novatek-nt36523.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Neil Armstrong Nov. 29, 2023, 3:52 p.m. UTC | #1
On 29/11/2023 10:07, 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: 0993234a0045 ("drm/panel: Add driver for Novatek NT36523")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>   drivers/gpu/drm/panel/panel-novatek-nt36523.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36523.c b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
> index 9b9a7eb1bc60..a189ce236328 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt36523.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
> @@ -1254,9 +1254,9 @@ static int nt36523_probe(struct mipi_dsi_device *dsi)
>   			return dev_err_probe(dev, -EPROBE_DEFER, "cannot get secondary DSI host\n");
>   
>   		pinfo->dsi[1] = mipi_dsi_device_register_full(dsi1_host, info);
> -		if (!pinfo->dsi[1]) {
> +		if (IS_ERR(pinfo->dsi[1])) {
>   			dev_err(dev, "cannot get secondary DSI device\n");
> -			return -ENODEV;
> +			return PTR_ERR(pinfo->dsi[1]);
>   		}
>   	}
>   

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Neil Armstrong Nov. 29, 2023, 3:56 p.m. UTC | #2
Hi,

On Wed, 29 Nov 2023 17:07:15 +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://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-fixes)

[1/1] drm/panel: nt36523: fix return value check in nt36523_probe()
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=fb18fe0fdf22a2f4512a8b644bb5ea1473829cda
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36523.c b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
index 9b9a7eb1bc60..a189ce236328 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36523.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
@@ -1254,9 +1254,9 @@  static int nt36523_probe(struct mipi_dsi_device *dsi)
 			return dev_err_probe(dev, -EPROBE_DEFER, "cannot get secondary DSI host\n");
 
 		pinfo->dsi[1] = mipi_dsi_device_register_full(dsi1_host, info);
-		if (!pinfo->dsi[1]) {
+		if (IS_ERR(pinfo->dsi[1])) {
 			dev_err(dev, "cannot get secondary DSI device\n");
-			return -ENODEV;
+			return PTR_ERR(pinfo->dsi[1]);
 		}
 	}