Skip to content

Commit cead55e

Browse files
committed
drm/plane: Fix create_in_format_blob() return value
create_in_format_blob() is either supposed to return a valid pointer or an error, but never NULL. The caller will dereference the blob when it is not an error, and thus will oops if NULL returned. Return proper error values in the failure cases. Cc: [email protected] Cc: Arun R Murthy <[email protected]> Fixes: 0d6dcd7 ("drm/plane: modify create_in_formats to acommodate async") Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patch.msgid.link/[email protected] Reviewed-by: Arun R Murthy <[email protected]>
1 parent d4f14fa commit cead55e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/drm_plane.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static struct drm_property_blob *create_in_format_blob(struct drm_device *dev,
210210
formats_size = sizeof(__u32) * plane->format_count;
211211
if (WARN_ON(!formats_size)) {
212212
/* 0 formats are never expected */
213-
return 0;
213+
return ERR_PTR(-EINVAL);
214214
}
215215

216216
modifiers_size =
@@ -226,7 +226,7 @@ static struct drm_property_blob *create_in_format_blob(struct drm_device *dev,
226226

227227
blob = drm_property_create_blob(dev, blob_size, NULL);
228228
if (IS_ERR(blob))
229-
return NULL;
229+
return blob;
230230

231231
blob_data = blob->data;
232232
blob_data->version = FORMAT_BLOB_CURRENT;

0 commit comments

Comments
 (0)