mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
iio: light: ltrf216a: fix runtime PM reference leak in error path
ltrf216a_get_lux() acquires a runtime PM reference by calling
ltrf216a_set_power_state(data, true). However, if
ltrf216a_read_data() fails, the function returns immediately without
dropping the reference.
This leaves the runtime PM usage count unbalanced, preventing the device
from autosuspending after a failed read.
Fix this by releasing the runtime PM reference before returning from the
error path.
Fixes: 83f0bcd40d ("iio: light: Add support for ltrf216a sensor")
Signed-off-by: Vidhu Sarwal <vidhu.linux@gmail.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
This commit is contained in:
parent
26e9213898
commit
c132aef0e7
|
|
@ -248,11 +248,10 @@ static int ltrf216a_get_lux(struct ltrf216a_data *data)
|
|||
return ret;
|
||||
|
||||
greendata = ltrf216a_read_data(data, LTRF216A_ALS_DATA_0);
|
||||
ltrf216a_set_power_state(data, false);
|
||||
if (greendata < 0)
|
||||
return greendata;
|
||||
|
||||
ltrf216a_set_power_state(data, false);
|
||||
|
||||
lux = greendata * data->info->lux_multiplier * LTRF216A_WIN_FAC;
|
||||
|
||||
return lux;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user