Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp338782pxf; Thu, 8 Apr 2021 04:20:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxuxvzW6kxdNz3DJk53qeeVQH61YR3lZl0VWzbruDmKnIKskidUacIDvzMv3FKG5gMprBD X-Received: by 2002:a17:90b:ecc:: with SMTP id gz12mr7787286pjb.79.1617880834167; Thu, 08 Apr 2021 04:20:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617880834; cv=none; d=google.com; s=arc-20160816; b=mCnZZpoh5eoXC5dIIoRDX1le74+l4kpEWMtfRv083Pdr/09tRzh3+Y228/2WHm0Y69 8a5xJWlqxOBQBm2AIayQ0qw/pQ3V/TwnUwOTFaLyFdAhbmnIccaQzal6frrzlnHCEL9j 8B5gFl8/9S3F+Fx5ahsKh2jC6bIjmaOpPAd20juQqr8gqOXGN3+hhHIPTexY4xoGxZac ylop39UmYh6ywzU3uiiA3gZXx93sv+esArRMm71cHDQAApK6R7ynoQ5XVYMcMIrsBs2c mWRgjenadjrYmcN8kBt7FCvfxCfRhZhi8Ts7wpyBonjxGVB3D6Rnxr4v/r9GoybyZOZd mKnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=P2pW36cHWg0UywT25UKLckdq/jDUlmPfcaLwLzG6l8E=; b=e2NzksEATLt/9OxPvEQHVks9xgAempSsJqX00syU92/nrF4l09sknqfSw/oXsReFpT n78E34zNDExx69CjYSjytUdpBkxMM/ie5vanzkfMrEJd6zW7DdXVwhkI7FB8I40TPnVi pzgNf7AZY4ICZihDj41qOFoqUPLI2tMTBBLLiIgNjATkeEOmBugMBwIztqoGrQqDwqjz GB/Uly6tWb9JGR4ClxSSA/6XzVeQjzg62zEjupLJrfg4OA2l1KdBFYII1wiDVaLqrLov wnj/RCgC+IjeIDituP1AFQ3K9YVuXjebrMDNykzaLP3eAakVk6VBKEMvbLksC3woIFG2 h69w== 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 w11si8510148pjb.25.2021.04.08.04.20.21; Thu, 08 Apr 2021 04:20:34 -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 S230412AbhDHLTs (ORCPT + 99 others); Thu, 8 Apr 2021 07:19:48 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:15971 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229751AbhDHLTr (ORCPT ); Thu, 8 Apr 2021 07:19:47 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FGJdH5C1HzrdK6; Thu, 8 Apr 2021 19:17:23 +0800 (CST) Received: from ubuntu1804.huawei.com (10.67.174.149) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.498.0; Thu, 8 Apr 2021 19:19:26 +0800 From: Ye Weihua To: , , , , , CC: , , , , Subject: [PATCH -next] i2c: imx-lpi2c: fix PM reference leak in lpi2c_imx_master_enable() Date: Thu, 8 Apr 2021 19:19:30 +0800 Message-ID: <20210408111930.203574-1-yeweihua4@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.174.149] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The PM reference count is not expected to be incremented on return in ipi2c_imx_master_enable(). However, pm_runtime_get_sync() will increment the PM reference count even on failure. forgetting to put the reference again will result in a leak. Replace it with pm_runtime_resume_and_get() to keep the usage counter balanced. Reported-by: Hulk Robot Signed-off-by: Ye Weihua --- drivers/i2c/busses/i2c-imx-lpi2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 9db6ccded5e9..8b9ba055c418 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -259,7 +259,7 @@ static int lpi2c_imx_master_enable(struct lpi2c_imx_struct *lpi2c_imx) unsigned int temp; int ret; - ret = pm_runtime_get_sync(lpi2c_imx->adapter.dev.parent); + ret = pm_runtime_resume_and_get(lpi2c_imx->adapter.dev.parent); if (ret < 0) return ret; -- 2.17.1