Message ID | 20230724140036.1022676-2-cuigaosheng1@huawei.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Fix IS_ERR() vs NULL check for drm | expand |
Hi Gaosheng, On Mon, Jul 24, 2023 at 10:00:34PM +0800, Gaosheng Cui wrote: > The mipi_dsi_device_register_full() returns an ERR_PTR() on failure, > we should use IS_ERR() to check the return value. > > By the way, use dev_err_probe instead of dev_err to print the error code. > > Fixes: 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC panels") > Signed-off-by: Gaosheng Cui <cuigaosheng1@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 8b108ac80b55..2731ce02ce53 100644 > --- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c > +++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c > @@ -571,8 +571,8 @@ 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]) { > - dev_err(dev, "Cannot get secondary DSI node\n"); > + if (IS_ERR(nt->dsi[1])) { > + dev_err_probe(dev, PTR_ERR(nt->dsi[1]), "Cannot get secondary DSI node\n"); > return -ENODEV; This code should return the error code we get from mipi_dsi_device_register_full(). To do so use: return dev_err_probe(...); Please fix and sorry for not noticing before. Sam
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c b/drivers/gpu/drm/panel/panel-novatek-nt35950.c index 8b108ac80b55..2731ce02ce53 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c @@ -571,8 +571,8 @@ 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]) { - dev_err(dev, "Cannot get secondary DSI node\n"); + if (IS_ERR(nt->dsi[1])) { + dev_err_probe(dev, PTR_ERR(nt->dsi[1]), "Cannot get secondary DSI node\n"); return -ENODEV; } num_dsis++;
The mipi_dsi_device_register_full() returns an ERR_PTR() on failure, we should use IS_ERR() to check the return value. By the way, use dev_err_probe instead of dev_err to print the error code. Fixes: 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC panels") Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com> --- drivers/gpu/drm/panel/panel-novatek-nt35950.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)