Skip to contentSkip to conversation

drm/plane: Fix error pointer vs NULL bug in create_in_format_blob()

PATCH In review Dan Carpenter 2 participants 2 messages May 23, 2025

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

PATCH 1/1 drm/plane: Fix error pointer vs NULL bug in create_in_format_blob()

The callers expect to receive error pointers on error but create_in_format_blob() returns NULL. Change it to return error pointers.

Fixes 0d6dcd741c26 ("drm/plane: modify create_in_formats to acommodate async")
---
 drivers/gpu/drm/drm_plane.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_plane.c +2 -2
index 04992dfd4c79..75a7e8aa6611 100644
@@ -209,7 +209,7 @@ static struct drm_property_blob *create_in_format_blob(struct drm_device *dev,
 	formats_size = sizeof(__u32) * plane->format_count;
 	if (WARN_ON(!formats_size)) {
 		/* 0 formats are never expected */
-		return 0;
+		return ERR_PTR(-EINVAL);
 	}
 
 	modifiers_size =
@@ -225,7 +225,7 @@ static struct drm_property_blob *create_in_format_blob(struct drm_device *dev,
 
 	blob = drm_property_create_blob(dev, blob_size, NULL);
 	if (IS_ERR(blob))
-		return NULL;
+		return blob;
 
 	blob_data = blob->data;
 	blob_data->version = FORMAT_BLOB_CURRENT;
Signature · 1 line
2.47.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Dan Carpenter

The callers expect to receive error pointers on error but create_in_format_blob() returns NULL. Change it to return error pointers.

Fixes 0d6dcd741c26 ("drm/plane: modify create_in_formats to acommodate async")
---
 drivers/gpu/drm/drm_plane.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 2 lines
With best wishes
Dmitry