Commit 1371f260 authored by Ville Syrjälä's avatar Ville Syrjälä

drm: WARN when trying add enum values to non-enum/bitmask properties

Trying to add enum values to non-enum/bitmask properties is a
programmer mistake. WARN to make sure the developers notice
their mistake.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180306164849.2862-2-ville.syrjala@linux.intel.comReviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 6f881d04
...@@ -378,8 +378,8 @@ int drm_property_add_enum(struct drm_property *property, int index, ...@@ -378,8 +378,8 @@ int drm_property_add_enum(struct drm_property *property, int index,
if (WARN_ON(strlen(name) >= DRM_PROP_NAME_LEN)) if (WARN_ON(strlen(name) >= DRM_PROP_NAME_LEN))
return -EINVAL; return -EINVAL;
if (!(drm_property_type_is(property, DRM_MODE_PROP_ENUM) || if (WARN_ON(!drm_property_type_is(property, DRM_MODE_PROP_ENUM) &&
drm_property_type_is(property, DRM_MODE_PROP_BITMASK))) !drm_property_type_is(property, DRM_MODE_PROP_BITMASK)))
return -EINVAL; return -EINVAL;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment