summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2024-10-30 18:19:19 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2024-11-01 14:54:47 +0000
commit869aa5e847696bcda8966be9d03de2560226bcc3 (patch)
tree502e9a95b71670ab76ece6feab1f8d06f76d5fba
parent8ebfd09255219ae55f8a101f6aeb0f64dd780d88 (diff)
downloadlinux-stable-869aa5e847696bcda8966be9d03de2560226bcc3.tar.gz
linux-stable-869aa5e847696bcda8966be9d03de2560226bcc3.tar.bz2
linux-stable-869aa5e847696bcda8966be9d03de2560226bcc3.zip
iio: adc: pac1921: Check for error code from devm_mutex_init() call
Even if it's not critical, the avoidance of checking the error code from devm_mutex_init() call today diminishes the point of using devm variant of it. Tomorrow it may even leak something. Add the missed check. Fixes: 371f778b83cd ("iio: adc: add support for pac1921") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Matteo Martelli <matteomartelli3@gmail.com> Link: https://patch.msgid.link/20241030162013.2100253-3-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r--drivers/iio/adc/pac1921.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/iio/adc/pac1921.c b/drivers/iio/adc/pac1921.c
index a96fae546bc1..43a3dd321a50 100644
--- a/drivers/iio/adc/pac1921.c
+++ b/drivers/iio/adc/pac1921.c
@@ -1170,7 +1170,9 @@ static int pac1921_probe(struct i2c_client *client)
return dev_err_probe(dev, PTR_ERR(priv->regmap),
"Cannot initialize register map\n");
- devm_mutex_init(dev, &priv->lock);
+ ret = devm_mutex_init(dev, &priv->lock);
+ if (ret)
+ return ret;
priv->dv_gain = PAC1921_DEFAULT_DV_GAIN;
priv->di_gain = PAC1921_DEFAULT_DI_GAIN;