summaryrefslogtreecommitdiff
path: root/drivers/media/i2c/hi846.c
diff options
context:
space:
mode:
authorMartin Kepplinger <martin.kepplinger@puri.sm>2023-04-25 12:47:47 +0300
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2023-05-25 17:21:23 +0300
commit04fc06f6dc1592ed5d675311ac50d8fba5db62ab (patch)
treed7a192d4dab6511e02553ac19c02045c3d7de858 /drivers/media/i2c/hi846.c
parente103484c76ab0898e6cf5067b1e3d45019a4fe0b (diff)
downloadlinux-04fc06f6dc1592ed5d675311ac50d8fba5db62ab.tar.xz
media: hi846: fix usage of pm_runtime_get_if_in_use()
pm_runtime_get_if_in_use() does not only return nonzero values when the device is in use, it can return a negative errno too. And especially during resuming from system suspend, when runtime pm is not yet up again, -EAGAIN is being returned, so the subsequent pm_runtime_put() call results in a refcount underflow. Fix system-resume by handling -EAGAIN of pm_runtime_get_if_in_use(). Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm> Fixes: e8c0882685f9 ("media: i2c: add driver for the SK Hynix Hi-846 8M pixel camera") Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'drivers/media/i2c/hi846.c')
-rw-r--r--drivers/media/i2c/hi846.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/i2c/hi846.c b/drivers/media/i2c/hi846.c
index 5283a09fd359..fa0038749a3b 100644
--- a/drivers/media/i2c/hi846.c
+++ b/drivers/media/i2c/hi846.c
@@ -1353,7 +1353,8 @@ static int hi846_set_ctrl(struct v4l2_ctrl *ctrl)
exposure_max);
}
- if (!pm_runtime_get_if_in_use(&client->dev))
+ ret = pm_runtime_get_if_in_use(&client->dev);
+ if (!ret || ret == -EAGAIN)
return 0;
switch (ctrl->id) {