Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp237724ybg; Sun, 31 May 2020 23:21:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsz3sfm2Lf8v7oSQfLbJyAhXYKcSyki5YQ59AgwBXFVwFSzdux9FRXlynGm8VlilNzH5FG X-Received: by 2002:aa7:d359:: with SMTP id m25mr7619258edr.365.1590992498597; Sun, 31 May 2020 23:21:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590992498; cv=none; d=google.com; s=arc-20160816; b=CPaHJRol2iT6nHeF+vuG06E5OviQHvYlGdeEn/20BLuCx2nXCtBEa6MO9JpIJ+RJz4 NvOjBpnlFQGCS3i8nMQ7j5qur0JntUpteplGwbtF1g2Ea5F0Ix9aMqNCLkfogqCYKtQn 6kfBI/GopQ6HUToLd5X0StJ35vfvwOBOubaIqmdPSTceExbJYg+NRI8BYW5bs9pMBQaA TNZ5AI3ujmv4vOjWyYcrI+gOM2tpMqxZ+iwXXB1YxzpJ3+ZSsoMkYVolYoVdEFICZ9un doO6hjMhveuIjmYV/0awAqpU/zfmbHVZL3BgqzpeBUnSxe+DVpmZayGrP17tEU8OKfYu KrHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=pXg1UVgGccTLdVunuxYtI3rLRhhKxMFjjHQtbZXX214=; b=mVdPbzeSX4xIpz4wxBdzLeHvIRo497IIREcIYgmiDwX4vJZtWBRhRPQXxYcFI8zaKA tRK8bK7GTIwAr1c6BmMToR2pxvfWaRBkUsz0Z2VjBSkgwBfVOw9sBk0ntSge03sIUBev a9c5qOd3bYWPXgzU1xjfVG+PqPBWByJnd0zwWfIPrkfjm5UOKLB3YaIdEDj6WNJDgp2f RnY3Gg+51sLJTnu9gWK6eNQWyyjrhycePu760hdHv/OPUKqf1TkTv5DXfF1nwz/bhX3B X1gLEMDAbjuEpBrr7d806r6FqCSGjahxGb2EvETtpv8mRSDj6QiuOX+11a1TbgJc4X9J vAOQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k23si7253303eji.601.2020.05.31.23.21.16; Sun, 31 May 2020 23:21:38 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726067AbgFAGRD (ORCPT + 99 others); Mon, 1 Jun 2020 02:17:03 -0400 Received: from spam.zju.edu.cn ([61.164.42.155]:23402 "EHLO zju.edu.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725778AbgFAGRD (ORCPT ); Mon, 1 Jun 2020 02:17:03 -0400 Received: from localhost.localdomain (unknown [222.205.72.4]) by mail-app3 (Coremail) with SMTP id cC_KCgDXgXhJndRe6TA0AA--.25744S4; Mon, 01 Jun 2020 14:16:45 +0800 (CST) From: Dinghao Liu To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: Markus Elfring , Dong Aisheng , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Wolfram Sang , Fugang Duan , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] [v3] i2c: imx-lpi2c: Fix runtime PM imbalance on error Date: Mon, 1 Jun 2020 14:16:40 +0800 Message-Id: <20200601061640.27632-1-dinghao.liu@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: cC_KCgDXgXhJndR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xBIdaVFxhVjvjDU0xZFpf9x0JU-J5rUUUUU= X-CM-SenderInfo: qrrzjiaqtzq6lmxovvfxof0/1tbiAgISBlZdtOZo2gAEs7 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pm_runtime_get_sync() increments the runtime PM usage counter even the call returns an error code. Thus a corresponding decrement is needed on the error handling path to keep the counter balanced. Fix this by adding the missed function call. Fixes: 13d6eb20fc79a ("i2c: imx-lpi2c: add runtime pm support") Co-developed-by: Markus Elfring Signed-off-by: Markus Elfring Signed-off-by: Dinghao Liu --- Changelog: v2: - Use pm_runtime_put_noidle() instead of pm_runtime_put_autosuspend(). v3: - Refine commit message. --- drivers/i2c/busses/i2c-imx-lpi2c.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 94743ba581fe..bdee02dff284 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -260,8 +260,10 @@ static int lpi2c_imx_master_enable(struct lpi2c_imx_struct *lpi2c_imx) int ret; ret = pm_runtime_get_sync(lpi2c_imx->adapter.dev.parent); - if (ret < 0) + if (ret < 0) { + pm_runtime_put_noidle(lpi2c_imx->adapter.dev.parent); return ret; + } temp = MCR_RST; writel(temp, lpi2c_imx->base + LPI2C_MCR); -- 2.17.1