diff mbox

[1/6] drm: Reject replacing property enum values

Message ID 20180306164849.2862-1-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä March 6, 2018, 4:48 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

If the property already has the enum value WARN and bail.
Replacing enum values doesn't make sense to me.

Throw out the pointless list_empty() while at it.

Cc: Daniel Vetter <daniel@ffwll.ch>
Suggested-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_property.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Comments

Daniel Vetter March 6, 2018, 6:16 p.m. UTC | #1
On Tue, Mar 06, 2018 at 06:48:44PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> If the property already has the enum value WARN and bail.
> Replacing enum values doesn't make sense to me.
> 
> Throw out the pointless list_empty() while at it.
> 
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Suggested-by: Daniel Vetter <daniel@ffwll.ch>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/drm_property.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
> index c37ac41125b5..d77b0c4dc485 100644
> --- a/drivers/gpu/drm/drm_property.c
> +++ b/drivers/gpu/drm/drm_property.c
> @@ -390,14 +390,9 @@ int drm_property_add_enum(struct drm_property *property, int index,
>  			(value > 63))
>  		return -EINVAL;
>  
> -	if (!list_empty(&property->enum_list)) {
> -		list_for_each_entry(prop_enum, &property->enum_list, head) {
> -			if (prop_enum->value == value) {
> -				strncpy(prop_enum->name, name, DRM_PROP_NAME_LEN);
> -				prop_enum->name[DRM_PROP_NAME_LEN-1] = '\0';
> -				return 0;
> -			}
> -		}
> +	list_for_each_entry(prop_enum, &property->enum_list, head) {
> +		if (WARN_ON(prop_enum->value == value))
> +			return -EINVAL;
>  	}
>  
>  	prop_enum = kzalloc(sizeof(struct drm_property_enum), GFP_KERNEL);
> -- 
> 2.16.1
>
Ville Syrjälä March 7, 2018, 4:18 p.m. UTC | #2
On Tue, Mar 06, 2018 at 09:49:29PM -0000, Patchwork wrote:
> == Series Details ==
> 
> Series: series starting with [1/6] drm: Reject replacing property enum values
> URL   : https://patchwork.freedesktop.org/series/39465/
> State : warning
> 
> == Summary ==
> 
> ---- Possible new issues:
> 
> Test kms_chv_cursor_fail:
>         Subgroup pipe-a-64x64-top-edge:
>                 dmesg-warn -> PASS       (shard-hsw)
>         Subgroup pipe-c-64x64-right-edge:
>                 pass       -> DMESG-WARN (shard-apl)

Unrelated pipe crc vs. vblank warn:

[   39.323847] WARNING: CPU: 1 PID: 0 at drivers/gpu/drm/drm_vblank.c:620 drm_calc_vbltimestamp_from_scanoutpos+0x13e/0x2f0

> 
> ---- Known issues:
> 
> Test gem_eio:
>         Subgroup in-flight-contexts:
>                 pass       -> INCOMPLETE (shard-apl) fdo#105341
> Test kms_atomic_transition:
>         Subgroup 1x-modeset-transitions:
>                 pass       -> FAIL       (shard-apl) fdo#103207
> Test kms_chv_cursor_fail:
>         Subgroup pipe-b-256x256-right-edge:
>                 dmesg-warn -> PASS       (shard-snb) fdo#105185
> Test kms_cursor_legacy:
>         Subgroup 2x-long-flip-vs-cursor-atomic:
>                 fail       -> PASS       (shard-hsw) fdo#104873
>         Subgroup flip-vs-cursor-toggle:
>                 fail       -> PASS       (shard-hsw) fdo#102670
> Test kms_flip:
>         Subgroup plain-flip-ts-check:
>                 fail       -> PASS       (shard-hsw) fdo#100368 +2
> Test kms_frontbuffer_tracking:
>         Subgroup fbc-1p-primscrn-spr-indfb-fullscreen:
>                 fail       -> PASS       (shard-apl) fdo#101623 +1
> Test pm_lpsp:
>         Subgroup screens-disabled:
>                 pass       -> FAIL       (shard-hsw) fdo#104941
> 
> fdo#105341 https://bugs.freedesktop.org/show_bug.cgi?id=105341
> fdo#103207 https://bugs.freedesktop.org/show_bug.cgi?id=103207
> fdo#105185 https://bugs.freedesktop.org/show_bug.cgi?id=105185
> fdo#104873 https://bugs.freedesktop.org/show_bug.cgi?id=104873
> fdo#102670 https://bugs.freedesktop.org/show_bug.cgi?id=102670
> fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
> fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
> fdo#104941 https://bugs.freedesktop.org/show_bug.cgi?id=104941
> 
> shard-apl        total:3381 pass:1779 dwarn:2   dfail:0   fail:7   skip:1591 time:11922s
> shard-hsw        total:3467 pass:1771 dwarn:1   dfail:0   fail:3   skip:1691 time:11848s
> shard-snb        total:3467 pass:1363 dwarn:1   dfail:0   fail:2   skip:2101 time:6972s
> Blacklisted hosts:
> shard-kbl        total:3394 pass:1908 dwarn:3   dfail:0   fail:8   skip:1474 time:9081s
> 
> == Logs ==
> 
> For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8247/shards.html
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
index c37ac41125b5..d77b0c4dc485 100644
--- a/drivers/gpu/drm/drm_property.c
+++ b/drivers/gpu/drm/drm_property.c
@@ -390,14 +390,9 @@  int drm_property_add_enum(struct drm_property *property, int index,
 			(value > 63))
 		return -EINVAL;
 
-	if (!list_empty(&property->enum_list)) {
-		list_for_each_entry(prop_enum, &property->enum_list, head) {
-			if (prop_enum->value == value) {
-				strncpy(prop_enum->name, name, DRM_PROP_NAME_LEN);
-				prop_enum->name[DRM_PROP_NAME_LEN-1] = '\0';
-				return 0;
-			}
-		}
+	list_for_each_entry(prop_enum, &property->enum_list, head) {
+		if (WARN_ON(prop_enum->value == value))
+			return -EINVAL;
 	}
 
 	prop_enum = kzalloc(sizeof(struct drm_property_enum), GFP_KERNEL);