Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3022699pxj; Mon, 17 May 2021 15:49:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzh40wQkRU//7vnk/R4NzwIVWWAFOI1rFd1a5PjufNYIA1yvvRzRCuL1+yKGremylbPlcmD X-Received: by 2002:a05:6638:3013:: with SMTP id r19mr2346129jak.36.1621291759846; Mon, 17 May 2021 15:49:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621291759; cv=none; d=google.com; s=arc-20160816; b=0z1Debqe3fql6Lw9AbhjMISKeDm/EYIKnOUKBVngwulCyC0Crhf0HMkDrHwqD4GOUH sz5xZUvneo12BC7sQbGVfrDNxpeXOuuqVpgvqmcPSUbtkcmv/GWwyPahlw3PknsUZeZv BH0EWOz1Ev490iks7PF0j0SVcjvNy8cteEQcVOeO672dluaPfA0mN56iwYqDiFd0IVbl Jl1354DzZCxqu3rG8mGaFF0FoUuomp4Apoif/5hArEYu7MHw/ZjksA6tJP6O6hcJpc00 f61Q8+o6fOpqAEgM7fR5+eD7oX4fqVwSbvFtuBg7nduDZflivrbER6Vm4Xx3m7I6q3yZ 8Sfg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DUAMbYVOrdLqRqn/RVFgIVebu9ZJgrLTFuJu/4Hs3eA=; b=GU/OH+EiWVDtH+563G3qgYc0YKzkagRuLcRZAaf9P+TIeSsu9xiHaytkwnpvK9jARb /jtHgpx2Grnyv/1/IMGPnkTxzgG/H0ATq2mC2nj5L7AluIVltNLmNAX/+8ew0dwIhvue NOZy3Hw9YL8cD8xYDXfQCNC6b1RBe2VbnXnDgOFzmznvratjejsiz6S8hWgaUuy123EE tuZVP6OvV2En3IOlV76ubJLDU5bbpNm2/QyyA+8QYAnBNdS5P5tLihN0rLYxTOF90oaf pX6YMAQcA13tqwckzZlrR0j3t6xc+Wn6AijH2aYHa2p4o1bXGdBfbYOq9S7QybMsZBOh XV5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K4mWYSsQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g5si1964786jan.100.2021.05.17.15.48.52; Mon, 17 May 2021 15:49:19 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K4mWYSsQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238662AbhEQOQP (ORCPT + 99 others); Mon, 17 May 2021 10:16:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:46510 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238463AbhEQOM4 (ORCPT ); Mon, 17 May 2021 10:12:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6BB8E61350; Mon, 17 May 2021 14:08:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260496; bh=2AQnckqxS9feE4LaNaTfupbxIBj+QVQWIJUO9IRnjvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K4mWYSsQ5a+glHGN3RtSmweFKNbENY8ukPDS6XA/uP7vqTIdTzTkzTsrxwumRK+MU BAVuOQU/l3rNnhYLhgtN45TwFGm2cCy7gySew8qjWE4Jr7FkrrivI8jLrILyHIv4f3 XQkxgXnBc+tZMKmQUCcWDK8O+GAyPIv/ZCd2igs8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Ye Weihua , Wolfram Sang , Sasha Levin Subject: [PATCH 5.12 072/363] i2c: imx: Fix PM reference leak in i2c_imx_reg_slave() Date: Mon, 17 May 2021 15:58:58 +0200 Message-Id: <20210517140305.025937706@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 dc9c4b4cc25a..dc5ca71906db 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -801,7 +801,7 @@ static int i2c_imx_reg_slave(struct i2c_client *client) i2c_imx->last_slave_event = I2C_SLAVE_STOP; /* 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