From patchwork Tue Sep 22 22:51:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 254703 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=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 EBA07C4741F for ; Tue, 22 Sep 2020 22:52:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B0AE6221EB for ; Tue, 22 Sep 2020 22:52:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TnsqWXHy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726949AbgIVWwm (ORCPT ); Tue, 22 Sep 2020 18:52:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726880AbgIVWwd (ORCPT ); Tue, 22 Sep 2020 18:52:33 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A896C061755; Tue, 22 Sep 2020 15:52:33 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id z19so19879815lfr.4; Tue, 22 Sep 2020 15:52:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fxbl5iVjnQ+NxsUTVaOXHns+qyxrphuUB6cPNnTHHzs=; b=TnsqWXHyOc3pUJrEtFvLbESg04ubCclKCuztZssHj47P8rqsaJevMSaifi/1u1ACze 974oZib2nRA/bbby2fzrgpEyyr4jNRDQqlSm/Me2BhCleFM5/L8AoLe5xmK1XkO7rdLk l6mh2c9ecK1duRiBucu0DpQ4eV5E3E1iDpvWU0p41BEkdLNyD4qN0+hfHodUMvEseJm8 CVOrPD3bo4N6O3qwq0TDrEOOUsgksfoU2Vw62RCySbx8ObR+BhTMHH9orlflNxnjgTU8 F73t5qbIziDoVAAAVcBrYcyOO3weq5ShgK3PMnADyePJesBAVSIp3/BBYgM3fTSk5+uk 4sKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fxbl5iVjnQ+NxsUTVaOXHns+qyxrphuUB6cPNnTHHzs=; b=MoNGgBW0OHLah6js9csdZYPKTAZY4bN3yu06JKQEyC3MYffewPZ1rzFiimQ+kBiEb/ WAeN+BMHV5n5Iks4YSeNSKDaN6ScrZ1qsJ+G9Jt1D8VAFTiYCkK+4ykYJ5ODrKhO76xn iCPDCKvvRsiEoFuUuJPuwihLN7Euq/f01sLBktRteyx2x9/IhBlk9oo2fPvhfewk26pU v3MMef6xn06pOCsTFvD54+iXYzeuKtX3boC9Gc5E901GYl4bRvJG7dtesm0qY5slcnFl RsZptM33S9fCQWoUb7w2dYJt7/bABqi2txXWIf96CdjHMsM0odQWoHp7ls/skY5pfLXG ntEg== X-Gm-Message-State: AOAM530wMVO38XnbK2+th9Xxj76uidFcO3VrAwE5ADsr2ryO92hPF0c9 jyayMnm2ZUevfs7pVTumOsU= X-Google-Smtp-Source: ABdhPJyUQpDCs74Y6ciWm+jbq1u4rmVCCf03JDp15EOvdD5cWRvG4bMa0XsYawE0SdavDbF/5Y84HQ== X-Received: by 2002:ac2:5dd3:: with SMTP id x19mr2745240lfq.340.1600815151845; Tue, 22 Sep 2020 15:52:31 -0700 (PDT) Received: from localhost.localdomain (109-252-170-211.dynamic.spd-mgts.ru. [109.252.170.211]) by smtp.gmail.com with ESMTPSA id l15sm3977588lfk.71.2020.09.22.15.52.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2020 15:52:31 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Laxman Dewangan , Wolfram Sang , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Andy Shevchenko Cc: linux-i2c@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v8 02/32] i2c: tegra: Add missing pm_runtime_put() Date: Wed, 23 Sep 2020 01:51:25 +0300 Message-Id: <20200922225155.10798-3-digetx@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200922225155.10798-1-digetx@gmail.com> References: <20200922225155.10798-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org The pm_runtime_get_sync() always bumps refcount regardless of whether it succeeds or fails. Hence driver is responsible for restoring of the RPM refcounting. This patch adds missing RPM puts which restore refcounting in a case of pm_runtime_get_sync() error. Suggested-by: Andy Shevchenko Reviewed-by: Thierry Reding Tested-by: Thierry Reding Signed-off-by: Dmitry Osipenko --- drivers/i2c/busses/i2c-tegra.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index ab88cdd70376..4e7d0eec0dd3 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -1375,6 +1375,7 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], ret = pm_runtime_get_sync(i2c_dev->dev); if (ret < 0) { dev_err(i2c_dev->dev, "runtime resume failed %d\n", ret); + pm_runtime_put_noidle(i2c_dev->dev); return ret; } @@ -1786,7 +1787,7 @@ static int tegra_i2c_probe(struct platform_device *pdev) ret = pm_runtime_get_sync(i2c_dev->dev); if (ret < 0) { dev_err(&pdev->dev, "runtime resume failed\n"); - goto disable_rpm; + goto put_rpm; } } @@ -1851,7 +1852,6 @@ static int tegra_i2c_probe(struct platform_device *pdev) else tegra_i2c_runtime_suspend(&pdev->dev); -disable_rpm: if (pm_runtime_enabled(&pdev->dev)) pm_runtime_disable(&pdev->dev);