[PATCH] Fix unused variable warning in 'drm_print.h'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



previous code can make unused variable warning,

e.g. when CONFIG_DRM_USE_DYNAMIC_DEBUG is set,
this outputs the following build error.

drivers/gpu/drm/drm_print.c: In function ‘__drm_printfn_dbg’:
drivers/gpu/drm/drm_print.c:218:33: error: unused variable ‘category’ [-Werror=unused-variable]
  218 |         enum drm_debug_category category = p->category;



so i simply add '(void)(category);' to remove unused variable warning,
by referring to "https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html";.

Signed-off-by: Gyeyoung Baek <gye976@xxxxxxxxx>
---
 include/drm/drm_print.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index d2676831d765..6a5dc1f73ff2 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -157,7 +157,7 @@ static inline bool drm_debug_enabled_raw(enum drm_debug_category category)
  * a descriptor, and only enabled callsites are reachable.  They use
  * the private macro to avoid re-testing the enable-bit.
  */
-#define __drm_debug_enabled(category)	true
+#define __drm_debug_enabled(category)	({ (void)(category); true; })
 #define drm_debug_enabled(category)	drm_debug_enabled_instrumented(category)
 #else
 #define __drm_debug_enabled(category)	drm_debug_enabled_raw(category)
-- 
2.34.1




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux