From mboxrd@z Thu Jan 1 00:00:00 1970 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=-17.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 40308C433B4 for ; Wed, 5 May 2021 16:48:53 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EB62A610FB for ; Wed, 5 May 2021 16:48:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB62A610FB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iZ12507YWp0khTO41XJTfh1Kidid/ZoO9Bi9kQBx6b8=; b=jot42J4vYDU3NnCKwlN4qUFce xLSA1dSAYCB2DxJv5x2b4iHxKtFaGcntdbZ/Z97RSPJUBQgnEAvgotmLVfg+H4+vHu7jSyEWES+Kl k8XYHPrtblK6TKqJxQPMJPWKSF4tZ0TTKrAU4TQoHAUAnOq3JFNKxeCLX0WIWEhCisD7F6Ra+FVNd da2o+rM9kYEt8GKnXo5pv/XKFGkpUTR4QHbDjPlbkQmM1E11pJ01K2wgXHy5Sk03UQky9Kjkhz7C/ o71BH8hJGi+cJQjyZnswsMlx1AHNaEOfVYns82IA6pnxN/2ZcYTPYQTJoxIu0FK89xtgpBeXXT7pe vLm67SrQw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1leKgJ-001kLq-2D; Wed, 05 May 2021 16:47:27 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leKUv-001fga-Gg for linux-arm-kernel@desiato.infradead.org; Wed, 05 May 2021 16:35:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=G4N18o44kOLYKsuWhuW25TP/CTmYTpxMzqPtMXWqqK4=; b=QpQTSCMstFLyvYNU/F04XIBDfv wWDmco19X73RXsecJdHdnLYDvn25ydmZTyQrSesoKIAaAc4aPAoEbtoPJE61UBSNUxsIUdA5J9CaB ev8wiQfkpY5rI5yrz+/glyUkbSbnCTDCdmmy5EFYscEU3jEwIL8LEfl4IPu2S1p8kuN66iHn/HbwL iqFo+YJ8uzV523h8SCWxxkHj+kydLkxOf1V3XB/iVF7itLWXQkXrdBBsh+n5deRCMPukUWGR9wxSI Gz5OWxXFO6zHxfyyav+ilfgeVFMbbU9/BCQueZS3NqiGndu4KTrYPjh0NhBrVuE+02myerBEmu2hi S20kwceg==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leKUs-004x87-Vx for linux-arm-kernel@lists.infradead.org; Wed, 05 May 2021 16:35:40 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8E41F61926; Wed, 5 May 2021 16:35:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620232538; bh=yMMHeJwtOjSzzGJkzTq+5P1IroFA0qOOWeJTB7p5iqE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OniYxozPZPpI48XA5CgtTsKWJEQ6Zj5RIk/r2x5oBqBDi/B28w662fT+p7WZNTw4e kSzFSpdxui28nUlcnXMA/hkprk9RSBqtQ4CpujyyX9exRUjmwChq/91l4c1/dleNc6 6oZHcs/RRzj7D9yuSvBjzjm3138bLF+p/3rroryDemKRc8+vcn/YlWMQHLP6WlRcr0 Z9MDe7aPGcoKLvA/mIORFWdGjSGYzNGBpbui7yRu+WMSmEup8jAkjfCP5wtDqti/jj V+pDtNQljYKM3p9rCLt+UEkheSL2zaH1FUXbJTxdFU9mXsNcU0cvz4t5HlWWxDknB4 pOQJsjaZv1vbQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ye Weihua , Hulk Robot , Wolfram Sang , Sasha Levin , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.11 058/104] i2c: imx: Fix PM reference leak in i2c_imx_reg_slave() Date: Wed, 5 May 2021 12:33:27 -0400 Message-Id: <20210505163413.3461611-58-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210505163413.3461611-1-sashal@kernel.org> References: <20210505163413.3461611-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210505_093539_077783_B6A7E86C X-CRM114-Status: GOOD ( 10.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ye Weihua [ Upstream commit c4b1fcc310e655fa8414696c38a84d36c00684c8 ] 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 Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index a8e8af57e33f..56c5a9f8c138 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -763,7 +763,7 @@ static int i2c_imx_reg_slave(struct i2c_client *client) i2c_imx->slave = client; /* Resume */ - ret = pm_runtime_get_sync(i2c_imx->adapter.dev.parent); + ret = pm_runtime_resume_and_get(i2c_imx->adapter.dev.parent); if (ret < 0) { dev_err(&i2c_imx->adapter.dev, "failed to resume i2c controller"); return ret; -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel