hwmon: (dell-smm): make struct dell_smm_data *data __maybe_unused
Subsystems (2)
PATCH 1/1 hwmon: (dell-smm): make struct dell_smm_data *data __maybe_unused
From: Jackie Liu <[email protected]>
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.
--- drivers/hwmon/dell-smm-hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/dell-smm-hwmon.c +1 -1
@@ -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);
Signature · 1 line
2.25.1
Pali Rohár
maintainerQuoted 6 lines · On Saturday 18 September 2021 13:13:00 Jackie Liu wrote:
From: Jackie Liu <[email protected]>
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]
Quoted 8 lines
624 | struct dell_smm_data *data = dev_get_drvdata(dev); | ^~~~[Why]
IfCONFIG_PROC_FS=n,proc_create_datais NULL, data is unused.[Fix]
Mark them__maybe_unusedto suppress that warning as well.
See: https://lore.kernel.org/linux-hwmon/[email protected]/t/#u
Quoted 23 lines
Fixes ba04d73c26ed ("hwmon: (dell-smm-hwmon) Move variables into a driver private data structure")Cc Armin Wolf <[email protected]>Signed-off-by Jackie Liu <[email protected]>--- drivers/hwmon/dell-smm-hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/hwmon/dell-smm-hwmon.c +1
-1@@ -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);Signature · 1 line
2.25.1