diff mbox series

[-next] hwmon: (jc42) Fix missing unlock on error in jc42_write()

Message ID 20221027062931.598247-1-yangyingliang@huawei.com (mailing list archive)
State Accepted
Headers show
Series [-next] hwmon: (jc42) Fix missing unlock on error in jc42_write() | expand

Commit Message

Yang Yingliang Oct. 27, 2022, 6:29 a.m. UTC
Add the missing unlock before return from function jc42_write()
in the error handling case.

Fixes: 37dedaee8bc6 ("hwmon: (jc42) Convert register access and caching to regmap/regcache")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/hwmon/jc42.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin Blumenstingl Oct. 27, 2022, 6:39 a.m. UTC | #1
On Thu, Oct 27, 2022 at 8:31 AM Yang Yingliang <yangyingliang@huawei.com> wrote:
>
> Add the missing unlock before return from function jc42_write()
> in the error handling case.
>
> Fixes: 37dedaee8bc6 ("hwmon: (jc42) Convert register access and caching to regmap/regcache")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Thanks for spotting and fixing this issue!
Guenter Roeck Oct. 27, 2022, 1:07 p.m. UTC | #2
On Thu, Oct 27, 2022 at 02:29:31PM +0800, Yang Yingliang wrote:
> Add the missing unlock before return from function jc42_write()
> in the error handling case.
> 
> Fixes: 37dedaee8bc6 ("hwmon: (jc42) Convert register access and caching to regmap/regcache")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Excellent catch. Applied to hwmon-next.

Thanks,
Guenter

> ---
>  drivers/hwmon/jc42.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c
> index 0554b41c32bc..6593d81cb901 100644
> --- a/drivers/hwmon/jc42.c
> +++ b/drivers/hwmon/jc42.c
> @@ -350,7 +350,7 @@ static int jc42_write(struct device *dev, enum hwmon_sensor_types type,
>  		ret = regmap_read(data->regmap, JC42_REG_TEMP_CRITICAL,
>  				  &regval);
>  		if (ret)
> -			return ret;
> +			break;
>  
>  		/*
>  		 * JC42.4 compliant chips only support four hysteresis values.
diff mbox series

Patch

diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c
index 0554b41c32bc..6593d81cb901 100644
--- a/drivers/hwmon/jc42.c
+++ b/drivers/hwmon/jc42.c
@@ -350,7 +350,7 @@  static int jc42_write(struct device *dev, enum hwmon_sensor_types type,
 		ret = regmap_read(data->regmap, JC42_REG_TEMP_CRITICAL,
 				  &regval);
 		if (ret)
-			return ret;
+			break;
 
 		/*
 		 * JC42.4 compliant chips only support four hysteresis values.