From: Yauhen Kharuzhy <jekhor@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>, linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Hans de Goede <hansg@kernel.org>
Subject: [PATCH v2 4/5] input: drv260x: Fix unbalanced regulator_disable() call
Date: Sun, 15 Feb 2026 16:14:34 +0200 [thread overview]
Message-ID: <20260215141435.727872-5-jekhor@gmail.com> (raw)
In-Reply-To: <20260215141435.727872-1-jekhor@gmail.com>
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>
---
drivers/input/misc/drv260x.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c
index c4dd410c303e..71fbdabc6589 100644
--- a/drivers/input/misc/drv260x.c
+++ b/drivers/input/misc/drv260x.c
@@ -520,19 +520,37 @@ static int drv260x_probe(struct i2c_client *client)
return error;
}
+ error = regulator_enable(haptics->regulator);
+ if (error) {
+ dev_err(dev, "Failed to enable regulator\n");
+ return error;
+ }
+
error = drv260x_init(haptics);
if (error) {
dev_err(dev, "Device init failed: %d\n", error);
- return error;
+ goto err_regulator_disable;
}
error = input_register_device(haptics->input_dev);
if (error) {
dev_err(dev, "couldn't register input device: %d\n", error);
- return error;
+ goto err_regulator_disable;
}
return 0;
+
+err_regulator_disable:
+ regulator_disable(haptics->regulator);
+
+ return error;
+}
+
+static void drv260x_remove(struct i2c_client *client)
+{
+ struct drv260x_data *haptics = i2c_get_clientdata(client);
+
+ regulator_disable(haptics->regulator);
}
static int drv260x_suspend(struct device *dev)
@@ -626,6 +644,7 @@ MODULE_DEVICE_TABLE(of, drv260x_of_match);
static struct i2c_driver drv260x_driver = {
.probe = drv260x_probe,
+ .remove = drv260x_remove,
.driver = {
.name = "drv260x-haptics",
.of_match_table = drv260x_of_match,
--
2.51.0
next prev parent reply other threads:[~2026-02-15 14:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-15 14:14 [PATCH v2 0/5] DRV260x: Support ACPI-enumerated devices Yauhen Kharuzhy
2026-02-15 14:14 ` [PATCH v2 1/5] input: drv260x: Add I2C IDs for all device variants Yauhen Kharuzhy
2026-02-15 14:14 ` [PATCH v2 2/5] input: drv260x: Sort all #include alphabetically Yauhen Kharuzhy
2026-02-15 14:14 ` [PATCH v2 3/5] input: drv260x: Add support for ACPI-enumerated devices Yauhen Kharuzhy
2026-02-15 14:14 ` Yauhen Kharuzhy [this message]
2026-02-19 2:43 ` [PATCH v2 4/5] input: drv260x: Fix unbalanced regulator_disable() call Dmitry Torokhov
2026-02-19 10:11 ` Yauhen Kharuzhy
2026-02-24 22:45 ` Dmitry Torokhov
2026-02-15 14:14 ` [PATCH v2 5/5] input: drv260x: Handle calibration timeout Yauhen Kharuzhy
2026-02-19 2:44 ` [PATCH v2 0/5] DRV260x: Support ACPI-enumerated devices Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260215141435.727872-5-jekhor@gmail.com \
--to=jekhor@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=hansg@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox