diff options
| author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2026-01-13 14:10:52 +0300 |
|---|---|---|
| committer | Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> | 2026-01-13 17:17:35 +0300 |
| commit | e05ef046ebb1ca879d885593130fa822ff664ca1 (patch) | |
| tree | bdb4f8432f60d131faa99c279ff4dca4b3ba94a3 | |
| parent | 568ea51e61f7da72ee290d24d6ee952586a3e168 (diff) | |
| download | linux-e05ef046ebb1ca879d885593130fa822ff664ca1.tar.xz | |
gpio: pca9570: Use devm_mutex_init() for mutex initialization
Use devm_mutex_init() since it brings some benefits when
CONFIG_DEBUG_MUTEXES is enabled.
Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20260113111156.188051-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
| -rw-r--r-- | drivers/gpio/gpio-pca9570.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-pca9570.c b/drivers/gpio/gpio-pca9570.c index c5a1287079a0..eae35135c71e 100644 --- a/drivers/gpio/gpio-pca9570.c +++ b/drivers/gpio/gpio-pca9570.c @@ -115,7 +115,9 @@ out: static int pca9570_probe(struct i2c_client *client) { + struct device *dev = &client->dev; struct pca9570 *gpio; + int ret; gpio = devm_kzalloc(&client->dev, sizeof(*gpio), GFP_KERNEL); if (!gpio) @@ -132,7 +134,9 @@ static int pca9570_probe(struct i2c_client *client) gpio->chip.ngpio = gpio->chip_data->ngpio; gpio->chip.can_sleep = true; - mutex_init(&gpio->lock); + ret = devm_mutex_init(dev, &gpio->lock); + if (ret) + return ret; /* Read the current output level */ pca9570_read(gpio, &gpio->out); |
