From: Jackie Liu <liu.yun@linux.dev>
To: pali@kernel.org, jdelvare@suse.com, linux@roeck-us.net
Cc: linux-hwmon@vger.kernel.org, liu.yun@linux.dev, W_Armin@gmx.de
Subject: [PATCH] hwmon: (dell-smm): make struct dell_smm_data *data __maybe_unused
Date: Sat, 18 Sep 2021 13:13:00 +0800 [thread overview]
Message-ID: <20210918051300.1171578-1-liu.yun@linux.dev> (raw)
From: Jackie Liu <liuyun01@kylinos.cn>
The compiler warns when the data are actually unused:
drivers/hwmon/dell-smm-hwmon.c: In function ‘i8k_init_procfs’:
drivers/hwmon/dell-smm-hwmon.c:624:24: error: unused variable ‘data’ [-Werror=unused-variable]
624 | struct dell_smm_data *data = dev_get_drvdata(dev);
| ^~~~
[Why]
If CONFIG_PROC_FS=n, proc_create_data is NULL, data is unused.
[Fix]
Mark them __maybe_unused to suppress that warning as well.
Fixes: ba04d73c26ed ("hwmon: (dell-smm-hwmon) Move variables into a driver private data structure")
Cc: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
---
drivers/hwmon/dell-smm-hwmon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
index 774c1b0715d9..d73f4a4bd96e 100644
--- a/drivers/hwmon/dell-smm-hwmon.c
+++ b/drivers/hwmon/dell-smm-hwmon.c
@@ -621,7 +621,7 @@ static void i8k_exit_procfs(void *param)
static void __init i8k_init_procfs(struct device *dev)
{
- struct dell_smm_data *data = dev_get_drvdata(dev);
+ struct dell_smm_data __maybe_unused *data = dev_get_drvdata(dev);
/* Register the proc entry */
proc_create_data("i8k", 0, NULL, &i8k_proc_ops, data);
--
2.25.1
next reply other threads:[~2021-09-18 5:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-18 5:13 Jackie Liu [this message]
2021-09-21 18:54 ` [PATCH] hwmon: (dell-smm): make struct dell_smm_data *data __maybe_unused Pali Rohár
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=20210918051300.1171578-1-liu.yun@linux.dev \
--to=liu.yun@linux.dev \
--cc=W_Armin@gmx.de \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=pali@kernel.org \
/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