From: Gyeyoung Baek <gye976@gmail.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Cc: Gyeyoung Baek <gye976@gmail.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH] Fix unused variable warning in 'drm_print.h'
Date: Tue, 29 Oct 2024 19:22:34 +0900 [thread overview]
Message-ID: <20241029102234.187480-1-gye976@gmail.com> (raw)
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@gmail.com>
---
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
reply other threads:[~2024-10-29 10:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241029102234.187480-1-gye976@gmail.com \
--to=gye976@gmail.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®