Re: [PATCH] hwmon: (dell-smm): make struct dell_smm_data *data __maybe_unused

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

 



On Saturday 18 September 2021 13:13:00 Jackie Liu wrote:
> From: Jackie Liu <liuyun01@xxxxxxxxxx>
> 
> 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.

See: https://lore.kernel.org/linux-hwmon/20210920121421.93297-1-arnd@xxxxxxxxxx/t/#u

> Fixes: ba04d73c26ed ("hwmon: (dell-smm-hwmon) Move variables into a driver private data structure")
> Cc: Armin Wolf <W_Armin@xxxxxx>
> Signed-off-by: Jackie Liu <liuyun01@xxxxxxxxxx>
> ---
>  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
> 



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux