From patchwork Fri Apr 9 02:57:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lu Jialin X-Patchwork-Id: 418521 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=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, 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 96963C433B4 for ; Fri, 9 Apr 2021 02:57:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 54443610F7 for ; Fri, 9 Apr 2021 02:57:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232960AbhDIC5b (ORCPT ); Thu, 8 Apr 2021 22:57:31 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:16104 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232662AbhDIC53 (ORCPT ); Thu, 8 Apr 2021 22:57:29 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FGjRC5GNLz1BGNM; Fri, 9 Apr 2021 10:55:03 +0800 (CST) Received: from ubuntu1804.huawei.com (10.67.174.175) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Fri, 9 Apr 2021 10:57:05 +0800 From: Lu Jialin To: , Sylwester Nawrocki , Mauro Carvalho Chehab CC: , , , , "Xiu Jianfeng" , Xiang Yang , "Wang Weiyang" , Cui GaoSheng , Gong Ruiqi Subject: [PATCH -next] media: s3c-camif: fix PM reference leak in s3c_camif_open() Date: Fri, 9 Apr 2021 10:57:09 +0800 Message-ID: <20210409025709.181908-1-lujialin4@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.67.174.175] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced. Reported-by: Hulk Robot Signed-off-by: Lu Jialin --- drivers/media/platform/s3c-camif/camif-capture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c index 9ca49af29542..62241ec3b978 100644 --- a/drivers/media/platform/s3c-camif/camif-capture.c +++ b/drivers/media/platform/s3c-camif/camif-capture.c @@ -547,7 +547,7 @@ static int s3c_camif_open(struct file *file) if (ret < 0) goto unlock; - ret = pm_runtime_get_sync(camif->dev); + ret = pm_runtime_resume_and_get(camif->dev); if (ret < 0) goto err_pm;