diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2018-03-06 18:48:45 +0200 |
---|---|---|
committer | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2018-03-07 18:20:53 +0200 |
commit | 1371f2604dad70942041a7f1ed1a2029c67606b1 (patch) | |
tree | 240b901aac0501315307d1fc2e7b64edc51f4526 | |
parent | 6f881d04f3f5112e1c4e913a4bfb22bb30e0c9e0 (diff) | |
download | op-kernel-dev-1371f2604dad70942041a7f1ed1a2029c67606b1.zip op-kernel-dev-1371f2604dad70942041a7f1ed1a2029c67606b1.tar.gz |
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: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180306164849.2862-2-ville.syrjala@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/drm_property.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c index d77b0c4..e676b1e 100644 --- a/drivers/gpu/drm/drm_property.c +++ b/drivers/gpu/drm/drm_property.c @@ -378,8 +378,8 @@ int drm_property_add_enum(struct drm_property *property, int index, if (WARN_ON(strlen(name) >= DRM_PROP_NAME_LEN)) return -EINVAL; - if (!(drm_property_type_is(property, DRM_MODE_PROP_ENUM) || - drm_property_type_is(property, DRM_MODE_PROP_BITMASK))) + if (WARN_ON(!drm_property_type_is(property, DRM_MODE_PROP_ENUM) && + !drm_property_type_is(property, DRM_MODE_PROP_BITMASK))) return -EINVAL; /* |