drm/plane: Fix a couple NULL vs error pointer bugs
Subsystems (2)
cover drm/plane: Fix a couple NULL vs error pointer bugs
These are a couple fixes for NULL vs error pointer mixups. I had sent the one earlier, and it was Acked but we forgot to apply it.
Dan Carpenter (3):
drm/plane: Clean up 0 vs NULL issue
drm/plane: Fix IS_ERR() vs NULL checks in
drm_plane_create_hotspot_properties()
drm/plane: Fix IS_ERR() vs NULL bugs in __drm_universal_plane_init()
drivers/gpu/drm/drm_plane.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
Signature · 1 line
2.47.2
PATCH 1/3 drm/plane: Clean up 0 vs NULL issue
The create_in_format_blob() function returns pointers, not integers. Change the zero to a NULL.
--- drivers/gpu/drm/drm_plane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_plane.c +1 -1
@@ -210,7 +210,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 NULL ; } modifiers_size =
Signature · 1 line
2.47.2
PATCH 2/3 drm/plane: Fix IS_ERR() vs NULL checks in drm_plane_create_hotspot_properties()
In reply to Dan CarpenterThe drm_property_create_signed_range() function returns NULL on error. It doesn't return error pointers. Fix the check to match.
---
This is a resend of a patch I sent a year ago.
https://lore.kernel.org/all/CABQX2QOoq3H=eHdM83_k5vgHiaMu9Zsto=H7S95QHxT-s16jEQ@mail.gmail.com/
--- drivers/gpu/drm/drm_plane.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_plane.c +4 -4
@@ -338,14 +338,14 @@ static int drm_plane_create_hotspot_properties(struct drm_plane *plane) prop_x =drm_property_create_signed_range (plane->dev,0 ,"HOTSPOT_X" ,INT_MIN ,INT_MAX ); -if (IS_ERR (prop_x)) -return PTR_ERR (prop_x); +if (!prop_x) +return -ENOMEM ; prop_y =drm_property_create_signed_range (plane->dev,0 ,"HOTSPOT_Y" ,INT_MIN ,INT_MAX ); -if (IS_ERR (prop_y)) { +if (!prop_y) {drm_property_destroy (plane->dev, prop_x); -return PTR_ERR (prop_y); +return -ENOMEM ; }drm_object_attach_property (&plane->base, prop_x,0 );
Signature · 1 line
2.47.2
PATCH 3/3 drm/plane: Fix IS_ERR() vs NULL bugs in __drm_universal_plane_init()
In reply to Dan CarpenterThe create_in_format_blob() function returns NULL on error. It never returns error pointers. Update the check to match.
--- drivers/gpu/drm/drm_plane.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_plane.c +2 -2
@@ -483,7 +483,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,if (format_modifier_count) { blob =create_in_format_blob (dev, plane, plane->funcs->format_mod_supported); -if (!IS_ERR (blob)) +if (blob)drm_object_attach_property (&plane->base, config->modifiers_property, blob->base.id);
@@ -492,7 +492,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,if (plane->funcs->format_mod_supported_async) { blob =create_in_format_blob (dev, plane, plane->funcs->format_mod_supported_async); -if (!IS_ERR (blob)) +if (blob)drm_object_attach_property (&plane->base, config->async_modifiers_property, blob->base.id);
Signature · 1 line
2.47.2