]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
drm: WARN when trying add enum values to non-enum/bitmask properties
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 6 Mar 2018 16:48:45 +0000 (18:48 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 7 Mar 2018 16:20:53 +0000 (18:20 +0200)
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>
drivers/gpu/drm/drm_property.c

index d77b0c4dc48572700c64bc5eb8bc98f83e32362e..e676b1ecc705f0c6a24a714ab4da628ceb95d424 100644 (file)
@@ -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;
 
        /*