mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
iio: light: gp2ap002: Disable regulators on resume failure
If enabling VIO fails after VDD has been enabled, runtime resume
returns without disabling VDD. Likewise, if device reinitialization
fails, both supplies remain enabled. The runtime PM core keeps the
device suspended when its resume callback fails, so the supplies must
be restored to the suspended state.
Disable the supplies enabled by the callback before returning an error.
Fixes: 97d642e230 ("iio: light: Add a driver for Sharp GP2AP002x00F")
Assisted-by: Codex:gpt-5
Signed-off-by: Laxman Acharya Padhya <acharyalaxman8848@gmail.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
This commit is contained in:
parent
a130404ce0
commit
a41000ba3a
|
|
@ -669,7 +669,7 @@ static int gp2ap002_runtime_resume(struct device *dev)
|
|||
ret = regulator_enable(gp2ap002->vio);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to enable VIO regulator in resume path\n");
|
||||
return ret;
|
||||
goto out_disable_vdd;
|
||||
}
|
||||
|
||||
msleep(20);
|
||||
|
|
@ -677,13 +677,19 @@ static int gp2ap002_runtime_resume(struct device *dev)
|
|||
ret = gp2ap002_init(gp2ap002);
|
||||
if (ret) {
|
||||
dev_err(dev, "re-initialization failed\n");
|
||||
return ret;
|
||||
goto out_disable_vio;
|
||||
}
|
||||
|
||||
/* Re-activate the IRQ */
|
||||
enable_irq(gp2ap002->irq);
|
||||
|
||||
return 0;
|
||||
|
||||
out_disable_vio:
|
||||
regulator_disable(gp2ap002->vio);
|
||||
out_disable_vdd:
|
||||
regulator_disable(gp2ap002->vdd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static DEFINE_RUNTIME_DEV_PM_OPS(gp2ap002_dev_pm_ops, gp2ap002_runtime_suspend,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user