linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Jean Delvare <jdelvare@suse.com>,
	Jean-Francois Dagenais <jeff.dagenais@gmail.com>,
	linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwmon: (max6650) Fix unused variable warning
Date: Mon, 17 Jun 2019 09:57:19 -0700	[thread overview]
Message-ID: <20190617165719.GA12640@roeck-us.net> (raw)
In-Reply-To: <20190617123746.769592-1-arnd@arndb.de>

On Mon, Jun 17, 2019 at 02:34:30PM +0200, Arnd Bergmann wrote:
> 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 <arnd@arndb.de>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/max6650.c | 19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c
> index 5fdad4645cca..3d9d371c35b5 100644
> --- a/drivers/hwmon/max6650.c
> +++ b/drivers/hwmon/max6650.c
> @@ -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;
>  }
>  

      reply	other threads:[~2019-06-17 16:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 12:34 [PATCH] hwmon: (max6650) Fix unused variable warning Arnd Bergmann
2019-06-17 16:57 ` Guenter Roeck [this message]

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=20190617165719.GA12640@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=arnd@arndb.de \
    --cc=jdelvare@suse.com \
    --cc=jeff.dagenais@gmail.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.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;
as well as URLs for NNTP newsgroup(s).