From patchwork Fri May 22 08:29:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dinghao Liu X-Patchwork-Id: 213354 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F6BCC433DF for ; Fri, 22 May 2020 08:29:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 31A78207FB for ; Fri, 22 May 2020 08:29:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728920AbgEVI3Z (ORCPT ); Fri, 22 May 2020 04:29:25 -0400 Received: from spam.zju.edu.cn ([61.164.42.155]:48140 "EHLO zju.edu.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728797AbgEVI3Z (ORCPT ); Fri, 22 May 2020 04:29:25 -0400 Received: from localhost.localdomain (unknown [222.205.77.158]) by mail-app3 (Coremail) with SMTP id cC_KCgCHHkFcjcdeT_DwAA--.32830S4; Fri, 22 May 2020 16:29:19 +0800 (CST) From: Dinghao Liu To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: Sylwester Nawrocki , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: platform: s3c-camif: Fix runtime PM imbalance in s3c_camif_open Date: Fri, 22 May 2020 16:29:15 +0800 Message-Id: <20200522082915.4731-1-dinghao.li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KxVW8Jr0_Cr1UYxBIdaVFxhVjvjDU0xZFpf9x0J USeHgUUUUU= X-CM-SenderInfo: qrrzjiaqtzq6lmxovvfxof0/1tbiAgEIBlZdtOQbggAIsH Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org 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. Also, call pm_runtime_put() and v4l2_fh_release() when sensor_set_power() returns an error code. Signed-off-by: Dinghao Liu --- drivers/media/platform/s3c-camif/camif-capture.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c index 9ca49af29542..d42d9cfaf674 100644 --- a/drivers/media/platform/s3c-camif/camif-capture.c +++ b/drivers/media/platform/s3c-camif/camif-capture.c @@ -552,11 +552,9 @@ static int s3c_camif_open(struct file *file) goto err_pm; ret = sensor_set_power(camif, 1); - if (!ret) - goto unlock; - pm_runtime_put(camif->dev); err_pm: + pm_runtime_put(camif->dev); v4l2_fh_release(file); unlock: mutex_unlock(&camif->lock);