summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/hwmon/ina2xx.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c
index 32bf4595bcb4..c4742e84b999 100644
--- a/drivers/hwmon/ina2xx.c
+++ b/drivers/hwmon/ina2xx.c
@@ -875,11 +875,11 @@ static ssize_t shunt_resistor_store(struct device *dev,
if (status < 0)
return status;
- hwmon_lock(dev);
- status = ina2xx_set_shunt(data, val);
- hwmon_unlock(dev);
- if (status < 0)
- return status;
+ scoped_guard(hwmon_lock, dev) {
+ status = ina2xx_set_shunt(data, val);
+ if (status < 0)
+ return status;
+ }
return count;
}