Skip to content

Commit

Permalink
iio: adc: pac1921: Check for error code from devm_mutex_init() call
Browse files Browse the repository at this point in the history
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: 371f778 ("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>
  • Loading branch information
Andy Shevchenko authored and Jonathan Cameron committed Nov 1, 2024
1 parent 8ebfd09 commit 869aa5e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/iio/adc/pac1921.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 869aa5e

Please sign in to comment.