瀏覽代碼

drm: WARN when trying to add enum value > 63 to a bitmask property

Enum values >63 with a bitmask property is a programmer error. WARN
when someone is attempting this.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180306164849.2862-3-ville.syrjala@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Ville Syrjälä 7 年之前
父節點
當前提交
8c6c2fe2f1
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      drivers/gpu/drm/drm_property.c

+ 2 - 2
drivers/gpu/drm/drm_property.c

@@ -386,8 +386,8 @@ int drm_property_add_enum(struct drm_property *property, int index,
 	 * Bitmask enum properties have the additional constraint of values
 	 * Bitmask enum properties have the additional constraint of values
 	 * from 0 to 63
 	 * from 0 to 63
 	 */
 	 */
-	if (drm_property_type_is(property, DRM_MODE_PROP_BITMASK) &&
-			(value > 63))
+	if (WARN_ON(drm_property_type_is(property, DRM_MODE_PROP_BITMASK) &&
+		    value > 63))
 		return -EINVAL;
 		return -EINVAL;
 
 
 	list_for_each_entry(prop_enum, &property->enum_list, head) {
 	list_for_each_entry(prop_enum, &property->enum_list, head) {