drm: WARN() when drm_connector_attach_property fails

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>
This commit is contained in:
Paulo Zanoni 2012-05-15 18:09:00 -03:00 committed by Dave Airlie
parent 26a3481586
commit afea2ad53f
2 changed files with 7 additions and 7 deletions

View File

@ -2819,7 +2819,7 @@ void drm_property_destroy(struct drm_device *dev, struct drm_property *property)
} }
EXPORT_SYMBOL(drm_property_destroy); 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) struct drm_property *property, uint64_t init_val)
{ {
int i; int i;
@ -2828,13 +2828,13 @@ int drm_connector_attach_property(struct drm_connector *connector,
if (connector->property_ids[i] == 0) { if (connector->property_ids[i] == 0) {
connector->property_ids[i] = property->base.id; connector->property_ids[i] = property->base.id;
connector->property_values[i] = init_val; connector->property_values[i] = init_val;
break; return;
} }
} }
if (i == DRM_CONNECTOR_MAX_PROPERTY) WARN(1, "Failed to attach connector property. Please increase "
return -EINVAL; "DRM_CONNECTOR_MAX_PROPERTY by 1 for each time you see this "
return 0; "message\n");
} }
EXPORT_SYMBOL(drm_connector_attach_property); EXPORT_SYMBOL(drm_connector_attach_property);

View File

@ -910,8 +910,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 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 bool drm_crtc_in_use(struct drm_crtc *crtc);
extern int drm_connector_attach_property(struct drm_connector *connector, extern void drm_connector_attach_property(struct drm_connector *connector,
struct drm_property *property, uint64_t init_val); struct drm_property *property, uint64_t init_val);
extern struct drm_property *drm_property_create(struct drm_device *dev, int flags, extern struct drm_property *drm_property_create(struct drm_device *dev, int flags,
const char *name, int num_values); const char *name, int num_values);
extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags, extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags,