OSDN Git Service

media: camss: csid: Fix runtime PM imbalance in csid_set_power
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Sat, 23 May 2020 07:36:39 +0000 (09:36 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 23 Jun 2020 11:19:43 +0000 (13:19 +0200)
pm_runtime_get_sync() increments the runtime PM usage counter even
when it returns an error code. Thus a pairing decrement is needed on
the error handling path to keep the counter balanced.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/qcom/camss/camss-csid.c

index a5ae856..8a247b6 100644 (file)
@@ -562,8 +562,10 @@ static int csid_set_power(struct v4l2_subdev *sd, int on)
                u32 hw_version;
 
                ret = pm_runtime_get_sync(dev);
-               if (ret < 0)
+               if (ret < 0) {
+                       pm_runtime_put_sync(dev);
                        return ret;
+               }
 
                ret = regulator_enable(csid->vdda);
                if (ret < 0) {