Skip to contentSkip to conversation

drm/connector: Fix warning in debug message

PATCH In review Maxime Ripard 2 participants 3 messages Jun 24, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/connector: Fix warning in debug message

The commit 3aeeb13d8996 ("drm/modes: Support modes names on the command line") added name support to the DRM modes, and added that name to the debug message.

However, that code tests for whether or not the name variable is NULL and only prints it if it's not. Except that that variable is an array, so it will never be NULL.

The original intent was to print it only when the name has been specified. Just printing the array directly will achieve the same thing since the drm_cmdline_mode structure that holds it is itself contained in drm_connector, that is allocated with its whole content zero'd.

That means that if the name is not declared, the array will be all zeros, which will not print anything.

Cc Nick Desaulniers <[email protected]>
Fixes 3aeeb13d8996 ("drm/modes: Support modes names on the command line")
---
 drivers/gpu/drm/drm_connector.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/drm_connector.c +1 -2
index 3afed5677946..068d4b05f1be 100644
@@ -140,8 +140,7 @@ static void drm_connector_get_cmdline_mode(struct drm_connector *connector)
 	}
 
 	DRM_DEBUG_KMS("cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
-		      connector->name,
-		      mode->name ? mode->name : "",
+		      connector->name, mode->name,
 		      mode->xres, mode->yres,
 		      mode->refresh_specified ? mode->refresh : 60,
 		      mode->rb ? " reduced blanking" : "",
Signature · 6 lines
2.21.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Maxime Ripard

The commit 3aeeb13d8996 ("drm/modes: Support modes names on the command line") added name support to the DRM modes, and added that name to the debug message.

However, that code tests for whether or not the name variable is NULL and only prints it if it's not. Except that that variable is an array, so it will never be NULL.

The original intent was to print it only when the name has been specified. Just printing the array directly will achieve the same thing since the drm_cmdline_mode structure that holds it is itself contained in drm_connector, that is allocated with its whole content zero'd.

Quoted 7 lines

That means that if the name is not declared, the array will be all zeros, which will not print anything.

Cc Nick Desaulniers <[email protected]>
Fixes 3aeeb13d8996 ("drm/modes: Support modes names on the command line")
Quoted 25 lines
---
 drivers/gpu/drm/drm_connector.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/drm_connector.c +1 -2
index 3afed5677946..068d4b05f1be 100644
@@ -140,8 +140,7 @@ static void drm_connector_get_cmdline_mode(struct drm_connector *connector)
 	}
 
 	DRM_DEBUG_KMS("cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
-		      connector->name,
-		      mode->name ? mode->name : "",
+		      connector->name, mode->name,
 		      mode->xres, mode->yres,
 		      mode->refresh_specified ? mode->refresh : 60,
 		      mode->rb ? " reduced blanking" : "",
Signature · 6 lines
2.21.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author Applied
#2 lore raw
Quoted 17 lines · Daniel Vetter
Quoted 16 lines · Maxime Ripard

The commit 3aeeb13d8996 ("drm/modes: Support modes names on the command line") added name support to the DRM modes, and added that name to the debug message.

However, that code tests for whether or not the name variable is NULL and only prints it if it's not. Except that that variable is an array, so it will never be NULL.

The original intent was to print it only when the name has been specified. Just printing the array directly will achieve the same thing since the drm_cmdline_mode structure that holds it is itself contained in drm_connector, that is allocated with its whole content zero'd.

That means that if the name is not declared, the array will be all zeros, which will not print anything.

Quoted 6 lines
Quoted 4 lines
Cc Nick Desaulniers <[email protected]>
Fixes 3aeeb13d8996 ("drm/modes: Support modes names on the command line")

Applied,

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel