hwmon: (max6650) Fix unused variable warning
PATCH 1/1 hwmon: (max6650) Fix unused variable warning
The newly added variable is only used in an #if block:
drivers/hwmon/max6650.c: In function 'max6650_probe':drivers/hwmon/max6650.c:766:33: error: unused variable 'cooling_dev' [-Werror=unused-variable]
Change the #if to if() so the compiler can see what is actually going on.
Fixes a8463754a5a9 ("hwmon: (max6650) Use devm function to register thermal device")
Signed-off-by Arnd Bergmann <[email protected]>
--- drivers/hwmon/max6650.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/hwmon/max6650.c +9 -10
@@ -467,8 +467,6 @@ static int max6650_init_client(struct max6650_data *data,return 0 ; } -#if IS_ENABLED (CONFIG_THERMAL ) -static int max6650_get_max_state (struct thermal_cooling_device *cdev,unsigned long *state) {
@@ -517,7 +515,6 @@ static const struct thermal_cooling_device_ops max6650_cooling_ops = { .get_cur_state = max6650_get_cur_state, .set_cur_state = max6650_set_cur_state, }; -#endif static int max6650_read (struct device *dev,enum hwmon_sensor_types type,u32 attr,int channel,long *val)
@@ -795,14 +792,16 @@ static int max6650_probe(struct i2c_client *client,if (err)return err; -#if IS_ENABLED (CONFIG_THERMAL ) - cooling_dev =devm_thermal_of_cooling_device_register (dev, dev->of_node, - client->name, data, &max6650_cooling_ops); -if (IS_ERR (cooling_dev)) { -dev_warn (dev,"thermal cooling device register failed: %ld\n" , -PTR_ERR (cooling_dev)); +if (IS_ENABLED (CONFIG_THERMAL )) { + cooling_dev =devm_thermal_of_cooling_device_register (dev, + dev->of_node, client->name, + data, &max6650_cooling_ops); +if (IS_ERR (cooling_dev)) { +dev_warn (dev,"thermal cooling device register failed: %ld\n" , +PTR_ERR (cooling_dev)); + } } -#endif +return 0 ; }
Signature · 1 line
2.20.0
Quoted 10 lines · Arnd Bergmann
The newly added variable is only used in an #if block:
drivers/hwmon/max6650.c: In function 'max6650_probe':drivers/hwmon/max6650.c:766:33: error: unused variable 'cooling_dev' [-Werror=unused-variable]Change the #if to
if()so the compiler can see what is actually going on.Fixes a8463754a5a9 ("hwmon: (max6650) Use devm function to register thermal device")Signed-off-by Arnd Bergmann <[email protected]>
Applied.
Thanks,
Guenter
Quoted 49 lines
--- drivers/hwmon/max6650.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)drivers/hwmon/max6650.c +9
-10@@ -467,8 +467,6 @@ static int max6650_init_client(struct max6650_data *data,return 0 ; } -#if IS_ENABLED (CONFIG_THERMAL ) -static int max6650_get_max_state (struct thermal_cooling_device *cdev,unsigned long *state) {@@ -517,7 +515,6 @@ static const struct thermal_cooling_device_ops max6650_cooling_ops = { .get_cur_state = max6650_get_cur_state, .set_cur_state = max6650_set_cur_state, }; -#endif static int max6650_read (struct device *dev,enum hwmon_sensor_types type,u32 attr,int channel,long *val)@@ -795,14 +792,16 @@ static int max6650_probe(struct i2c_client *client,if (err)return err; -#if IS_ENABLED (CONFIG_THERMAL ) - cooling_dev =devm_thermal_of_cooling_device_register (dev, dev->of_node, - client->name, data, &max6650_cooling_ops); -if (IS_ERR (cooling_dev)) { -dev_warn (dev,"thermal cooling device register failed: %ld\n" , -PTR_ERR (cooling_dev)); +if (IS_ENABLED (CONFIG_THERMAL )) { + cooling_dev =devm_thermal_of_cooling_device_register (dev, + dev->of_node, client->name, + data, &max6650_cooling_ops); +if (IS_ERR (cooling_dev)) { +dev_warn (dev,"thermal cooling device register failed: %ld\n" , +PTR_ERR (cooling_dev)); + } } -#endif +return 0 ; }