Skip to contentSkip to conversation

drm/panel: nt37801: Fix IS_ERR() vs NULL check in probe()

PATCH Applied Dan Carpenter 4 participants 4 messages May 23, 2025

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/panel: nt37801: Fix IS_ERR() vs NULL check in probe()

The devm_drm_panel_alloc() function returns error pointers, it doesn't return NULL. Update the check to match.

Fixes 4fca6849864d ("drm/panel: Add Novatek NT37801 panel driver")
---
 drivers/gpu/drm/panel/panel-novatek-nt37801.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-novatek-nt37801.c +2 -2
index 84d367eab058..d6a37d7e0cc6 100644
@@ -257,8 +257,8 @@ static int novatek_nt37801_probe(struct mipi_dsi_device *dsi)
 	ctx = devm_drm_panel_alloc(dev, struct novatek_nt37801, panel,
 				   &novatek_nt37801_panel_funcs,
 				   DRM_MODE_CONNECTOR_DSI);
-	if (!ctx)
-		return -ENOMEM;
+	if (IS_ERR(ctx))
+		return PTR_ERR(ctx);
 
 	ret = devm_regulator_bulk_get_const(dev,
 					    ARRAY_SIZE(novatek_nt37801_supplies),
Signature · 1 line
2.47.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Dan Carpenter

The devm_drm_panel_alloc() function returns error pointers, it doesn't return NULL. Update the check to match.

Fixes 4fca6849864d ("drm/panel: Add Novatek NT37801 panel driver")
Quoted 19 lines
---
  drivers/gpu/drm/panel/panel-novatek-nt37801.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-novatek-nt37801.c +2 -2
index 84d367eab058..d6a37d7e0cc6 100644
@@ -257,8 +257,8 @@ static int novatek_nt37801_probe(struct mipi_dsi_device *dsi)
  	ctx = devm_drm_panel_alloc(dev, struct novatek_nt37801, panel,
  				   &novatek_nt37801_panel_funcs,
  				   DRM_MODE_CONNECTOR_DSI);
-	if (!ctx)
-		return -ENOMEM;
+	if (IS_ERR(ctx))
+		return PTR_ERR(ctx);
 
  	ret = devm_regulator_bulk_get_const(dev,
  					    ARRAY_SIZE(novatek_nt37801_supplies),
#3 lore raw
In reply to Dan Carpenter
Quoted 4 lines · Dan Carpenter

The devm_drm_panel_alloc() function returns error pointers, it doesn't return NULL. Update the check to match.

Applied to drm-misc-next-fixes, thanks!

[1/1] drm/panel: nt37801: Fix IS_ERR() vs NULL check in probe()

      commit: 4673dec88da803fa23f1af9e04761683a30dd6aa

Best regards,

Signature · 1 line
Dmitry Baryshkov <[email protected]>