mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
iio: srf04: fix pm_runtime handling on probe error path
When pm_runtime_set_active() fails during probe, the driver logs the
error and unregisters the IIO device, but then falls through and still
calls pm_runtime_enable() before returning the error.
Since probe returns an error, srf04_remove() is never called, so
runtime PM is left enabled without a matching pm_runtime_disable().
This leaks the enable and triggers an "Unbalanced pm_runtime_enable!"
warning on a subsequent bind of the device.
Return the error right after unregistering the IIO device so that
runtime PM is not enabled on the failure path.
Fixes: 2251157b33 ("iio: srf04: add power management feature")
Cc: stable@vger.kernel.org
Signed-off-by: Cong Nguyen <congnt264@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
This commit is contained in:
parent
d39afd249d
commit
a40b2e7a17
|
|
@ -331,6 +331,7 @@ static int srf04_probe(struct platform_device *pdev)
|
|||
if (ret) {
|
||||
dev_err(data->dev, "pm_runtime_set_active: %d\n", ret);
|
||||
iio_device_unregister(indio_dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
pm_runtime_enable(data->dev);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user