drm: fix fb refcount issue with atomic modesetting
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 31 May 2016 12:03:18 +0000 (15:03 +0300)
committerDave Airlie <airlied@redhat.com>
Wed, 1 Jun 2016 05:00:05 +0000 (15:00 +1000)
After commit 027b3f8ba9277410c3191d72d1ed2c6146d8a668 ("drm/modes: stop
handling framebuffer special") extra fb refs are left around when doing
atomic modesetting.

The problem is that the new drm_property_change_valid_get() does not
return anything in the '**ref' parameter, which causes
drm_property_change_valid_put() to do nothing.

For some reason this doesn't cause problems with legacy API.

Also, previously the code only set the 'ref' variable for fbs, with this
patch the 'ref' is set for all objects.

Fixes: 027b3f8ba927 ("drm/modes: stop handling framebuffer special")
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_crtc.c

index 06b6e2173697e41df1ddc73e56ee83c875f6ed66..0e3cc66aa8b7d45803e39d36cb26faac494a3568 100644 (file)
@@ -4839,7 +4839,8 @@ bool drm_property_change_valid_get(struct drm_property *property,
                if (value == 0)
                        return true;
 
-               return _object_find(property->dev, value, property->values[0]) != NULL;
+               *ref = _object_find(property->dev, value, property->values[0]);
+               return *ref != NULL;
        }
 
        for (i = 0; i < property->num_values; i++)