UPSTREAM: drm: WARN() when drm_connector_attach_property fails
authorPaulo Zanoni <paulo.r.zanoni@intel.com>
Tue, 15 May 2012 21:09:00 +0000 (18:09 -0300)
committerChromeBot <chrome-bot@google.com>
Wed, 27 Mar 2013 18:35:08 +0000 (11:35 -0700)
Also return void instead of int. We have more than 100 callers and
no one checks for the return value.

If this function fails the property won't be exposed by the get/set
ioctls, but we should probably survive. If this starts happening,
the solution will be to increase DRM_CONNECTOR_MAX_PROPERTY and
recompile the Kernel.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Rob Clark <rob.clark@linaro.org>
Tested-by: Rob Clark <rob.clark@linaro.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit afea2ad53f1fef0b57d0e59fa062f54797158b14)

BUG=chrome-os-partner:17074
TEST=Use hardware cursor with kernel v3.8 and v3.4 and no flicker on screen.

Change-Id: Ibcf34e79c3f310a53345bfde5ee7853495171ced
Signed-off-by: Prathyush K <prathyush.k@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/40510
Tested-by: Prathyush Kalashwaram <prathyush@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Stéphane Marchesin <marcheu@chromium.org>

drivers/gpu/drm/drm_crtc.c
include/drm/drm_crtc.h

index a153922..69858ad 100644 (file)
@@ -2830,7 +2830,7 @@ void drm_property_destroy(struct drm_device *dev, struct drm_property *property)
 }
 EXPORT_SYMBOL(drm_property_destroy);
 
-int drm_connector_attach_property(struct drm_connector *connector,
+void drm_connector_attach_property(struct drm_connector *connector,
                               struct drm_property *property, uint64_t init_val)
 {
        int i;
@@ -2839,13 +2839,13 @@ int drm_connector_attach_property(struct drm_connector *connector,
                if (connector->property_ids[i] == 0) {
                        connector->property_ids[i] = property->base.id;
                        connector->property_values[i] = init_val;
-                       break;
+                       return;
                }
        }
 
-       if (i == DRM_CONNECTOR_MAX_PROPERTY)
-               return -EINVAL;
-       return 0;
+       WARN(1, "Failed to attach connector property. Please increase "
+               "DRM_CONNECTOR_MAX_PROPERTY by 1 for each time you see this "
+               "message\n");
 }
 EXPORT_SYMBOL(drm_connector_attach_property);
 
index b8e26c4..04b16c5 100644 (file)
@@ -955,8 +955,8 @@ extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
 extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY);
 extern bool drm_crtc_in_use(struct drm_crtc *crtc);
 
-extern int drm_connector_attach_property(struct drm_connector *connector,
-                                     struct drm_property *property, uint64_t init_val);
+extern void drm_connector_attach_property(struct drm_connector *connector,
+                                         struct drm_property *property, uint64_t init_val);
 extern struct drm_property *drm_property_create(struct drm_device *dev, int flags,
                                                const char *name, int num_values);
 extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags,