linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] drm/plane: Fix a couple NULL vs error pointer bugs
@ 2025-08-19  9:38 Dan Carpenter
  2025-08-19  9:38 ` [PATCH 1/3] drm/plane: Clean up 0 vs NULL issue Dan Carpenter
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2025-08-19  9:38 UTC (permalink / raw)
  To: Arun R Murthy
  Cc: Chaitanya Kumar Borah, David Airlie, dri-devel, Harry Wentland,
	Javier Martinez Canillas, linux-kernel, Maarten Lankhorst,
	Maxime Ripard, Simona Vetter, Suraj Kandpal, Thomas Zimmermann,
	Ville Syrjälä, Xaver Hugl, Zack Rusin

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(-)

-- 
2.47.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] drm/plane: Clean up 0 vs NULL issue
  2025-08-19  9:38 [PATCH 0/3] drm/plane: Fix a couple NULL vs error pointer bugs Dan Carpenter
@ 2025-08-19  9:38 ` Dan Carpenter
  2025-08-19  9:38 ` [PATCH 2/3] drm/plane: Fix IS_ERR() vs NULL checks in drm_plane_create_hotspot_properties() Dan Carpenter
  2025-08-19  9:38 ` [PATCH 3/3] drm/plane: Fix IS_ERR() vs NULL bugs in __drm_universal_plane_init() Dan Carpenter
  2 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2025-08-19  9:38 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	dri-devel, linux-kernel

The create_in_format_blob() function returns pointers, not integers.
Change the zero to a NULL.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/gpu/drm/drm_plane.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 38f82391bfda..ad21fc855aea 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -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 =
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] drm/plane: Fix IS_ERR() vs NULL checks in drm_plane_create_hotspot_properties()
  2025-08-19  9:38 [PATCH 0/3] drm/plane: Fix a couple NULL vs error pointer bugs Dan Carpenter
  2025-08-19  9:38 ` [PATCH 1/3] drm/plane: Clean up 0 vs NULL issue Dan Carpenter
@ 2025-08-19  9:38 ` Dan Carpenter
  2025-08-19  9:38 ` [PATCH 3/3] drm/plane: Fix IS_ERR() vs NULL bugs in __drm_universal_plane_init() Dan Carpenter
  2 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2025-08-19  9:38 UTC (permalink / raw)
  To: Zack Rusin
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Javier Martinez Canillas, dri-devel, linux-kernel

The drm_property_create_signed_range() function returns NULL on error.  It
doesn't return error pointers.  Fix the check to match.

Fixes: 8f7179a1027d ("drm/atomic: Add support for mouse hotspots")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Zack Rusin <zack.rusin@broadcom.com>
---
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(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index ad21fc855aea..beef2a06bc75 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -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);
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] drm/plane: Fix IS_ERR() vs NULL bugs in __drm_universal_plane_init()
  2025-08-19  9:38 [PATCH 0/3] drm/plane: Fix a couple NULL vs error pointer bugs Dan Carpenter
  2025-08-19  9:38 ` [PATCH 1/3] drm/plane: Clean up 0 vs NULL issue Dan Carpenter
  2025-08-19  9:38 ` [PATCH 2/3] drm/plane: Fix IS_ERR() vs NULL checks in drm_plane_create_hotspot_properties() Dan Carpenter
@ 2025-08-19  9:38 ` Dan Carpenter
  2 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2025-08-19  9:38 UTC (permalink / raw)
  To: Arun R Murthy
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Ville Syrjälä, Harry Wentland,
	Suraj Kandpal, Xaver Hugl, Chaitanya Kumar Borah, dri-devel,
	linux-kernel

The create_in_format_blob() function returns NULL on error.  It never
returns error pointers.  Update the check to match.

Fixes: 0d6dcd741c26 ("drm/plane: modify create_in_formats to acommodate async")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/gpu/drm/drm_plane.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index beef2a06bc75..2f5a95bc0528 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -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);
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-19  9:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-19  9:38 [PATCH 0/3] drm/plane: Fix a couple NULL vs error pointer bugs Dan Carpenter
2025-08-19  9:38 ` [PATCH 1/3] drm/plane: Clean up 0 vs NULL issue Dan Carpenter
2025-08-19  9:38 ` [PATCH 2/3] drm/plane: Fix IS_ERR() vs NULL checks in drm_plane_create_hotspot_properties() Dan Carpenter
2025-08-19  9:38 ` [PATCH 3/3] drm/plane: Fix IS_ERR() vs NULL bugs in __drm_universal_plane_init() Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).