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.

Input: drv260x - fix unbalanced regulator_disable() call

The driver acquires the 'vbat' regulator during probing but never enables
it. Consequently, in the suspend method, the driver disables the regulator
without enabling it first, causing an 'Unbalanced regulator_disable()'
error.

Enable the regulator in the probe() method and add the remove() method with
regulator disabling to fix this.

Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
Link: https://patch.msgid.link/20260215141435.727872-5-jekhor@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Yauhen Kharuzhy and committed by
Dmitry Torokhov
e7b53288 710a1a8c

+18
+18
drivers/input/misc/drv260x.c
··· 9 9 10 10 #include <linux/acpi.h> 11 11 #include <linux/delay.h> 12 + #include <linux/device/devres.h> 12 13 #include <linux/gpio/consumer.h> 13 14 #include <linux/i2c.h> 14 15 #include <linux/input.h> ··· 434 433 .cache_type = REGCACHE_NONE, 435 434 }; 436 435 436 + static void drv260x_power_off(void *data) 437 + { 438 + struct drv260x_data *haptics = data; 439 + 440 + regulator_disable(haptics->regulator); 441 + } 442 + 437 443 static int drv260x_probe(struct i2c_client *client) 438 444 { 439 445 struct device *dev = &client->dev; ··· 505 497 dev_err(dev, "unable to get regulator, error: %d\n", error); 506 498 return error; 507 499 } 500 + 501 + error = regulator_enable(haptics->regulator); 502 + if (error) { 503 + dev_err(dev, "Failed to enable regulator: %d\n", error); 504 + return error; 505 + } 506 + 507 + error = devm_add_action_or_reset(dev, drv260x_power_off, haptics); 508 + if (error) 509 + return error; 508 510 509 511 haptics->enable_gpio = devm_gpiod_get_optional(dev, "enable", 510 512 GPIOD_OUT_HIGH);