Skip to contentSkip to conversation

drm/panel: focaltech-ota7290b: Fix error check for devm_drm_panel_alloc()

PATCH Applied Chen Ni 2 participants 3 messages Apr 29 – May 5

Subsystems (3)
lore
Share & tools
lore

Chen Ni

author
#0 lore raw

PATCH 1/1 drm/panel: focaltech-ota7290b: Fix error check for devm_drm_panel_alloc()

The devm_drm_panel_alloc() function returns an error pointer on failure, not NULL. Fix the check to use IS_ERR() and return PTR_ERR() to correctly handle allocation failures.

Fixes 07853e954248 ("drm/panel: add driver for Waveshare 8.8" DSI TOUCH-A panel")
---
 drivers/gpu/drm/panel/panel-focaltech-ota7290b.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-focaltech-ota7290b.c +2 -2
index dd420bb19440..ed02a8daf96f 100644
@@ -156,8 +156,8 @@ static int ota7290b_probe(struct mipi_dsi_device *dsi)
 	ctx = devm_drm_panel_alloc(&dsi->dev, struct ota7290b, panel,
 				   &ota7290b_funcs,
 				   DRM_MODE_CONNECTOR_DSI);
-	if (!ctx)
-		return -ENOMEM;
+	if (IS_ERR(ctx))
+		return PTR_ERR(ctx);
 	mipi_dsi_set_drvdata(dsi, ctx);
 	ctx->dsi = dsi;
 
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Chen Ni

The devm_drm_panel_alloc() function returns an error pointer on failure, not NULL. Fix the check to use IS_ERR() and return PTR_ERR() to correctly handle allocation failures.

Fixes 07853e954248 ("drm/panel: add driver for Waveshare 8.8" DSI TOUCH-A panel")
---
  drivers/gpu/drm/panel/panel-focaltech-ota7290b.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-focaltech-ota7290b.c +0 -0
index dd420bb19440..ed02a8daf96f 100644

drivers/gpu/drm/panel/panel-focaltech-ota7290b.c static int ota7290b_probe(struct mipi_dsi_device *dsi) · line 163

Quoted 10 lines
drivers/gpu/drm/panel/panel-focaltech-ota7290b.c +2 -2
@@ -156,8 +156,8 @@ static int ota7290b_probe(struct mipi_dsi_device *dsi)
  	ctx = devm_drm_panel_alloc(&dsi->dev, struct ota7290b, panel,
  				   &ota7290b_funcs,
  				   DRM_MODE_CONNECTOR_DSI);
-	if (!ctx)
-		return -ENOMEM;
+	if (IS_ERR(ctx))
+		return PTR_ERR(ctx);
  	mipi_dsi_set_drvdata(dsi, ctx);
  	ctx->dsi = dsi;
 

Thanks,
Neil

maintainer Applied
#2 lore raw
In reply to Chen Ni

Hi,

Quoted 3 lines · Chen Ni

The devm_drm_panel_alloc() function returns an error pointer on failure, not NULL. Fix the check to use IS_ERR() and return PTR_ERR() to correctly handle allocation failures.

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

[1/1] drm/panel: focaltech-ota7290b: Fix error check for devm_drm_panel_alloc()

      https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/71fa1bccaa957b0f51c1e1bedff2541741ec2b0c
Signature · 1 line
Neil