Skip to content

Commit fd0a4b3

Browse files
ZheyuMadtor
authored andcommitted
Input: cypress-sf - register a callback to disable the regulators
When the driver fails to probe, we will get the following splat: [ 19.311970] ------------[ cut here ]------------ [ 19.312566] WARNING: CPU: 3 PID: 375 at drivers/regulator/core.c:2257 _regulator_put+0x3ec/0x4e0 [ 19.317591] RIP: 0010:_regulator_put+0x3ec/0x4e0 [ 19.328831] Call Trace: [ 19.329112] <TASK> [ 19.329369] regulator_bulk_free+0x82/0xe0 [ 19.329860] devres_release_group+0x319/0x3d0 [ 19.330357] i2c_device_probe+0x766/0x940 Fix this by adding a callback that will deal with the disabling when the driver fails to probe. Signed-off-by: Zheyu Ma <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 8b188fb commit fd0a4b3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/input/keyboard/cypress-sf.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ static irqreturn_t cypress_sf_irq_handler(int irq, void *devid)
6161
return IRQ_HANDLED;
6262
}
6363

64+
static void cypress_sf_disable_regulators(void *arg)
65+
{
66+
struct cypress_sf_data *touchkey = arg;
67+
68+
regulator_bulk_disable(ARRAY_SIZE(touchkey->regulators),
69+
touchkey->regulators);
70+
}
71+
6472
static int cypress_sf_probe(struct i2c_client *client)
6573
{
6674
struct cypress_sf_data *touchkey;
@@ -121,6 +129,12 @@ static int cypress_sf_probe(struct i2c_client *client)
121129
return error;
122130
}
123131

132+
error = devm_add_action_or_reset(&client->dev,
133+
cypress_sf_disable_regulators,
134+
touchkey);
135+
if (error)
136+
return error;
137+
124138
touchkey->input_dev = devm_input_allocate_device(&client->dev);
125139
if (!touchkey->input_dev) {
126140
dev_err(&client->dev, "Failed to allocate input device\n");

0 commit comments

Comments
 (0)