Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Andy Shevchenko and committed by
Bartosz Golaszewski
e05ef046 568ea51e

+5 -1
+5 -1
drivers/gpio/gpio-pca9570.c
··· 115 115 116 116 static int pca9570_probe(struct i2c_client *client) 117 117 { 118 + struct device *dev = &client->dev; 118 119 struct pca9570 *gpio; 120 + int ret; 119 121 120 122 gpio = devm_kzalloc(&client->dev, sizeof(*gpio), GFP_KERNEL); 121 123 if (!gpio) ··· 134 132 gpio->chip.ngpio = gpio->chip_data->ngpio; 135 133 gpio->chip.can_sleep = true; 136 134 137 - mutex_init(&gpio->lock); 135 + ret = devm_mutex_init(dev, &gpio->lock); 136 + if (ret) 137 + return ret; 138 138 139 139 /* Read the current output level */ 140 140 pca9570_read(gpio, &gpio->out);