Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1013581pxf; Thu, 8 Apr 2021 19:59:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz444ZZ/3AIQnw1kIrIabHi0NmYdiCd7EBCK8ja3Ygu3M1CrC2yIZ20QC7QSgfryWNqQc4a X-Received: by 2002:a17:902:e5c8:b029:e4:c22d:4da6 with SMTP id u8-20020a170902e5c8b02900e4c22d4da6mr10667081plf.10.1617937172346; Thu, 08 Apr 2021 19:59:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617937172; cv=none; d=google.com; s=arc-20160816; b=Wz0FgFcbt8+JYiDrJcvzjolhVzVUrSCL44Q8RX6eMLn1wlfXJyiG2zk0C4Va1TjjPv bwS3tgSW3/AWLH8cUtbDc2B06pha3q7mOKgrokPjHcW3+20cj9W0rGfQ/L5evFsjyyUo +Ey1tlZgSbBCWnf6HQBO1siPi+c6s89poJJRX0HIVRsFwBQXPLOulH8DIJXXbowtjdJN WYzvuGVflg0VAHMMIGHwJxP8BdRNDO0NfvvxP9b4X1NOg3TS3B4UI3BHXJtPHrKBe6c/ eWy291GYLiWN+9Wqx0mnUeQ6MqYj5NWbTXZKIIavV1XBOfHKpc3gxs9MGhdOnEbjgdHM 0Yjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=GsnslJI7HYxuwGZPvhzRm3yysdMbupshADu6KLHZGks=; b=KLWE/hAb21BJ+E/3/gythNSpOF8VGxIQ+XAEt507vhhL7HlCBancExDYBqyfW98Q0w 2JXHJEDFnDMBJ9d6LyDRdJJKb+NpOAJQpGKZUcdcF3o0wKKqjQoTmA6d8rL1sDdcNJ0I FTUghxucntWKVmFH/9mU+CnmbAJCpJSBWGCDRVVL2WfpY5ftAGsJ9rJTMm9OVciJfb2C /TEaNUJi2j202Q65vPzWKqqQiYjnTQCFN7RyFFgsSqaUIlaKyLNP+xuB/LwUpXKMCr1X tq7aR9mAFbErPSwM6LKxCEDKIryEfxfwi9xSWPR4jpL5y8rN27497ngkiEXAi7VpxE1d OcLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x13si1891581pja.158.2021.04.08.19.59.20; Thu, 08 Apr 2021 19:59:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233077AbhDIC5b (ORCPT + 99 others); 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 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.174.175] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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;