linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Jens Axboe <axboe@kernel.dk>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>, Shaohua Li <shli@fb.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>,
	Hannes Reinecke <hare@suse.de>, Jan Kara <jack@suse.cz>,
	Damien Le Moal <damien.lemoal@wdc.com>,
	Luis Chamberlain <mcgrof@kernel.org>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] block: avoid -Wunused-but-set-parameter warning
Date: Tue, 23 Mar 2021 14:12:19 +0100	[thread overview]
Message-ID: <20210323131337.2510952-1-arnd@kernel.org> (raw)

From: Arnd Bergmann <arnd@arndb.de>

Building with 'make W=1' shows a warning for one function parameter
that is only set but not used in some configurations:

kernel/trace/blktrace.c: In function '__trace_note_message':
kernel/trace/blktrace.c:148:63: error: parameter 'blkcg' set but not used [-Werror=unused-but-set-parameter]
  148 | void __trace_note_message(struct blk_trace *bt, struct blkcg *blkcg,

Move the assignment into the #ifdef block that contains the only
use to clarify how it's used and avoid the warning.

Apparently this is the only -Wunused-but-set-parameter warning in the
kernel as of v5.12, after similar cleanups done by others. It may be time
to turn it on globally.

Fixes: 35fe6d763229 ("block: use standard blktrace API to output cgroup info for debug notes")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 kernel/trace/blktrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index c221e4c3f625..f9314351a7e2 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -170,9 +170,9 @@ void __trace_note_message(struct blk_trace *bt, struct blkcg *blkcg,
 	n = vscnprintf(buf, BLK_TN_MAX_MSG, fmt, args);
 	va_end(args);
 
+#ifdef CONFIG_BLK_CGROUP
 	if (!(blk_tracer_flags.val & TRACE_BLK_OPT_CGROUP))
 		blkcg = NULL;
-#ifdef CONFIG_BLK_CGROUP
 	trace_note(bt, current->pid, BLK_TN_MESSAGE, buf, n,
 		   blkcg ? cgroup_id(blkcg->css.cgroup) : 1);
 #else
-- 
2.29.2


                 reply	other threads:[~2021-03-23 13:15 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=20210323131337.2510952-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=arnd@arndb.de \
    --cc=axboe@kernel.dk \
    --cc=chaitanya.kulkarni@wdc.com \
    --cc=damien.lemoal@wdc.com \
    --cc=hare@suse.de \
    --cc=jack@suse.cz \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=shli@fb.com \
    /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;
as well as URLs for NNTP newsgroup(s).