Linux-Hwmon Archive on lore.kernel.org
 help / Atom feed
* [PATCH -next] hwmon: (lm80) Fix missing unlock on error in set_fan_div()
@ 2018-12-26 11:28 Wei Yongjun
  2018-12-26 15:41 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2018-12-26 11:28 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck, Kangjie Lu
  Cc: Wei Yongjun, linux-hwmon, kernel-janitors

Add the missing unlock before return from function set_fan_div()
in the error handling case.

Fixes: c9c63915519b ("hwmon: (lm80) fix a missing check of the status of SMBus read")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/hwmon/lm80.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c
index 0e30fa0..f9b8e3e 100644
--- a/drivers/hwmon/lm80.c
+++ b/drivers/hwmon/lm80.c
@@ -393,8 +393,10 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
 	}
 
 	rv = lm80_read_value(client, LM80_REG_FANDIV);
-	if (rv < 0)
+	if (rv < 0) {
+		mutex_unlock(&data->update_lock);
 		return rv;
+	}
 	reg = (rv & ~(3 << (2 * (nr + 1))))
 	    | (data->fan_div[nr] << (2 * (nr + 1)));
 	lm80_write_value(client, LM80_REG_FANDIV, reg);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] hwmon: (lm80) Fix missing unlock on error in set_fan_div()
  2018-12-26 11:28 [PATCH -next] hwmon: (lm80) Fix missing unlock on error in set_fan_div() Wei Yongjun
@ 2018-12-26 15:41 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2018-12-26 15:41 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: Jean Delvare, Kangjie Lu, linux-hwmon, kernel-janitors

On Wed, Dec 26, 2018 at 11:28:24AM +0000, Wei Yongjun wrote:
> Add the missing unlock before return from function set_fan_div()
> in the error handling case.
> 
> Fixes: c9c63915519b ("hwmon: (lm80) fix a missing check of the status of SMBus read")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/lm80.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c
> index 0e30fa0..f9b8e3e 100644
> --- a/drivers/hwmon/lm80.c
> +++ b/drivers/hwmon/lm80.c
> @@ -393,8 +393,10 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
>  	}
>  
>  	rv = lm80_read_value(client, LM80_REG_FANDIV);
> -	if (rv < 0)
> +	if (rv < 0) {
> +		mutex_unlock(&data->update_lock);
>  		return rv;
> +	}
>  	reg = (rv & ~(3 << (2 * (nr + 1))))
>  	    | (data->fan_div[nr] << (2 * (nr + 1)));
>  	lm80_write_value(client, LM80_REG_FANDIV, reg);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-26 11:28 [PATCH -next] hwmon: (lm80) Fix missing unlock on error in set_fan_div() Wei Yongjun
2018-12-26 15:41 ` Guenter Roeck

Linux-Hwmon Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-hwmon/0 linux-hwmon/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-hwmon linux-hwmon/ https://lore.kernel.org/linux-hwmon \
		linux-hwmon@vger.kernel.org linux-hwmon@archiver.kernel.org
	public-inbox-index linux-hwmon


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-hwmon


AGPL code for this site: git clone https://public-inbox.org/ public-inbox