Skip to contentSkip to conversation

drm/amdgpu/display: avoid unused-variable warning

PATCH In review Arnd Bergmann 2 participants 2 messages Apr 8, 2020

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

PATCH 1/1 drm/amdgpu/display: avoid unused-variable warning

Without CONFIG_DEBUG_FS, this newly added function causes a harmless warning:

amdgpu_dm/amdgpu_dm.c: In function 'amdgpu_dm_connector_late_register':
amdgpu_dm/amdgpu_dm.c:4723:30: error: unused variable 'amdgpu_dm_connector' [-Werror=unused-variable]
4723 | struct amdgpu_dm_connector *amdgpu_dm_connector =

      |                              ^~~~~~~~~~~~~~~~~~~

Use an IS_ENABLED() check instead to let the compiler see what is going on.

Fixes 14f04fa4834a ("drm/amdgpu/display: add a late register connector callback")
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -5
index d3674d805a0a..8ab23fe98059 100644
@@ -51,9 +51,7 @@
 #include "amdgpu_dm_irq.h"
 #include "dm_helpers.h"
 #include "amdgpu_dm_mst_types.h"
-#if defined(CONFIG_DEBUG_FS)
 #include "amdgpu_dm_debugfs.h"
-#endif
 
 #include "ivsrcid/ivsrcid_vislands30.h"
 
@@ -4723,9 +4721,8 @@ amdgpu_dm_connector_late_register(struct drm_connector *connector)
 	struct amdgpu_dm_connector *amdgpu_dm_connector =
 		to_amdgpu_dm_connector(connector);
 
-#if defined(CONFIG_DEBUG_FS)
-	connector_debugfs_init(amdgpu_dm_connector);
-#endif
+	if (IS_ENABLED(CONFIG_DEBUG_FS))
+		connector_debugfs_init(amdgpu_dm_connector);
 
 	return 0;
 }
Signature · 6 lines
2.26.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 7 lines · Arnd Bergmann

Without CONFIG_DEBUG_FS, this newly added function causes a harmless warning:

amdgpu_dm/amdgpu_dm.c: In function 'amdgpu_dm_connector_late_register':
amdgpu_dm/amdgpu_dm.c:4723:30: error: unused variable 'amdgpu_dm_connector' [-Werror=unused-variable]
4723 | struct amdgpu_dm_connector *amdgpu_dm_connector =

Quoted 7 lines
      |                              ^~~~~~~~~~~~~~~~~~~

Use an IS_ENABLED() check instead to let the compiler see what is going on.

Fixes 14f04fa4834a ("drm/amdgpu/display: add a late register connector callback")

Already fixed:
https://cgit.freedesktop.org/~agd5f/linux/commit/?h=drm-next&id=ef04ca2a941ae62cef517eac08210fed5c20fd5d

Alex

Quoted 33 lines
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -6
index d3674d805a0a..8ab23fe98059 100644
@@ -51,9 +51,7 @@
 #include "amdgpu_dm_irq.h"
 #include "dm_helpers.h"
 #include "amdgpu_dm_mst_types.h"
-#if defined(CONFIG_DEBUG_FS)
 #include "amdgpu_dm_debugfs.h"
-#endif
 
 #include "ivsrcid/ivsrcid_vislands30.h"
 
@@ -4723,9 +4721,8 @@ amdgpu_dm_connector_late_register(struct drm_connector *connector)
        struct amdgpu_dm_connector *amdgpu_dm_connector =
                to_amdgpu_dm_connector(connector);
 
-#if defined(CONFIG_DEBUG_FS)
-       connector_debugfs_init(amdgpu_dm_connector);
-#endif
+       if (IS_ENABLED(CONFIG_DEBUG_FS))
+               connector_debugfs_init(amdgpu_dm_connector);
 
        return 0;
 }
--

2.26.0

Quoted 4 lines

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

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