Skip to contentSkip to conversation

drm: allow drm_property_change_is_valid() to work on FB's

PATCH In review Rob Clark 2 participants 3 messages Nov 27, 2014

Subsystems (2)
lore
Share & tools
lore

Rob Clark

author
#0 lore raw

PATCH 1/1 drm: allow drm_property_change_is_valid() to work on FB's

_object_find() is not supposed to check for refcnt'd objects, that is done in drm_mode_object_find().

---
 drivers/gpu/drm/drm_crtc.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/drm_crtc.c +0 -3
index 9972cc8..3ba84df 100644
@@ -356,9 +356,6 @@ static struct drm_mode_object *_object_find(struct drm_device *dev,
 		obj = NULL;
 	if (obj && obj->id != id)
 		obj = NULL;
-	/* don't leak out unref'd fb's */
-	if (obj && (obj->type == DRM_MODE_OBJECT_FB))
-		obj = NULL;
 	mutex_unlock(&dev->mode_config.idr_mutex);
 
 	return obj;
Signature · 6 lines
1.9.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 13 lines · Rob Clark

_object_find() is not supposed to check for refcnt'd objects, that is done in drm_mode_object_find().

---
 drivers/gpu/drm/drm_crtc.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/drm_crtc.c +0 -0
index 9972cc8..3ba84df 100644

drivers/gpu/drm/drm_crtc.c static struct drm_mode_object *_object_find(struct drm_device *dev, · line 359

Quoted 7 lines
drivers/gpu/drm/drm_crtc.c +0 -3
@@ -356,9 +356,6 @@ static struct drm_mode_object *_object_find(struct drm_device *dev,
 		obj = NULL;
 	if (obj && obj->id != id)
 		obj = NULL;
-	/* don't leak out unref'd fb's */
-	if (obj && (obj->type == DRM_MODE_OBJECT_FB))
-		obj = NULL;
 	mutex_unlock(&dev->mode_config.idr_mutex);

Can't we just create a new _object_exists which returns bool? I know that this is safe, but it's also really tricky. And we have to get rid of the fairly useful comment explaining why this is dangerous.

It's a bit of copypasted code, but imo that's much better here. Especially if there's a comment about refcounted objects. So still nack for this one. -Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#2 lore raw
Quoted 9 lines · Daniel Vetter
Quoted 8 lines · Rob Clark

_object_find() is not supposed to check for refcnt'd objects, that is done in drm_mode_object_find().

---
 drivers/gpu/drm/drm_crtc.c | 3 ---
 1 file changed, 3 deletions(-)
Quoted 16 lines

drivers/gpu/drm/drm_crtc.c static struct drm_mode_object *_object_find(struct drm_device *dev, · line 359

Quoted 12 lines
drivers/gpu/drm/drm_crtc.c +0 -3
index 9972cc8..3ba84df 100644
@@ -356,9 +356,6 @@ static struct drm_mode_object *_object_find(struct drm_device *dev,
              obj = NULL;
      if (obj && obj->id != id)
              obj = NULL;
-     /* don't leak out unref'd fb's */
-     if (obj && (obj->type == DRM_MODE_OBJECT_FB))
-             obj = NULL;
      mutex_unlock(&dev->mode_config.idr_mutex);

Can't we just create a new _object_exists which returns bool? I know that this is safe, but it's also really tricky. And we have to get rid of the fairly useful comment explaining why this is dangerous.

that is basically the point of _object_find() :-)

I'll add a comment that this doesn't take a ref so for refcnt'd mode objects returning non-null only means the object did exist

BR,
-R

Quoted 7 lines

It's a bit of copypasted code, but imo that's much better here. Especially if there's a comment about refcounted objects. So still nack for this one. -Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel