From patchwork Wed May 5 18:29:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lukasz Stelmach X-Patchwork-Id: 12240831 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.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 14F42C433ED for ; Wed, 5 May 2021 18:31:27 +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 6EB96613C1 for ; Wed, 5 May 2021 18:31:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6EB96613C1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com 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:References:MIME-Version: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:In-Reply-To:List-Owner; bh=BrotvfWdDpwZ90RRPwDQl4ByflTRu1Tcj4swXUMBEoU=; b=G2swprm/mE1kvk1StEmKhdH11 dfK1/8NZ43nzkCZy+8yqEbg2KXSbewRIe5qhFha1x65NYfVo7l12dCIgEfq/JbbVYdnAp5NbvBDSI R1NmYTzgiOPUc74uv4tJLzNt0hpc9qhc0XeNLtiMVyPbRsQXJvb21vRSDB9l89wUCacLqkNmR30KV jSIrxriWjQHVrJFsRTQJgyp39EUUsg9rjuYIzsdhMQMo/skRt25neKKVhFDDhnQgfSire0Z68wm0o yqqUL0iAQmwErjcnncveRuWiMNm4g66wMrMEr4hKqa1ufmYJljKCEk6E1CvfEl0XROVU0maHvTKDY sZ5MN2WNw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1leMH5-0022B8-V3; Wed, 05 May 2021 18:29:32 +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 1leMH3-0022Aj-5C for linux-arm-kernel@desiato.infradead.org; Wed, 05 May 2021 18:29:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=References:Content-Type: Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description:In-Reply-To; bh=oVEQziOY+kXo+vyFMVyn0DaTqxIxQdU0Ku2D15pzPhY=; b=pQFUwe7tJkAzeusACNnFcT+IkQ OvXlYhAlNdGWw9V/Du3d42J+qRGW+Cp3mZQu6hgaorU0JaAr2dJ2Ihyy8XwT5O3lh1xITko3mMSrV QhA6QBuhC2m2gif/98Q6d1Q5uPXvDF98+65RBVZagO3X/44osHE99qqeftn0njXj8UuK0UMmgZbpf 1sE5FQ8aqQE6FT2f+pdS6JEOSdEckQPHNk6bJSwXVsk9e0pIuRRunPDrhLQ9UbQO6FFEuyFbA+3j8 1gOaY6V8z4bdNiPV3LJiuTP36rK+OxX0wEEIsA84OP5Y3ZRRX85MFzffjPWMf+Kmg2X2hW7k2oKJW QxobA5pQ==; Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leMGz-00597m-0X for linux-arm-kernel@lists.infradead.org; Wed, 05 May 2021 18:29:27 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20210505182919euoutp01891edbbf0dde58e80293ff3c16b1dac6~8Pxz4SKPm1832818328euoutp01f for ; Wed, 5 May 2021 18:29:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20210505182919euoutp01891edbbf0dde58e80293ff3c16b1dac6~8Pxz4SKPm1832818328euoutp01f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1620239359; bh=oVEQziOY+kXo+vyFMVyn0DaTqxIxQdU0Ku2D15pzPhY=; h=From:To:Cc:Subject:Date:References:From; b=pyu4k/3tZ3pWUwIUxmiXti+W0wGcQhC/9oe7gw0kj24GLWmOKfU269XWTBfDUxisQ ZwFsq1dzDOrIfQPXwMyrslQdKZDHGcISfhh+oPsdlEZxyGx5pkUfOQbE7aRPmyvbJc LbWVuKM892hiwEs3Q2L8iBfafeJPpTwJet4g8PUU= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20210505182919eucas1p2c19b3c886e883bcafe5021335a2c58c2~8PxzjV3bn2241322413eucas1p28; Wed, 5 May 2021 18:29:19 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 8A.E6.09452.FF3E2906; Wed, 5 May 2021 19:29:19 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20210505182918eucas1p18a11263e5d214e3356ac65d79504e430~8PxytjLWH2149121491eucas1p1s; Wed, 5 May 2021 18:29:18 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210505182918eusmtrp1e1f8a821222adcd91ffb99da175a5325~8PxyqeMlv0828408284eusmtrp1C; Wed, 5 May 2021 18:29:18 +0000 (GMT) X-AuditID: cbfec7f2-ab7ff700000024ec-2c-6092e3ff52f1 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 1B.61.08696.EF3E2906; Wed, 5 May 2021 19:29:18 +0100 (BST) Received: from localhost (unknown [106.120.51.46]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210505182918eusmtip16ca47f8c61710aa88104b0177f7601c5~8PxycSDaL2219822198eusmtip1g; Wed, 5 May 2021 18:29:18 +0000 (GMT) From: =?utf-8?q?=C5=81ukasz_Stelmach?= To: Matt Mackall , Herbert Xu , Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Bart=C5=82omiej_=C5=BBolnierkiewicz?= , Marek Szyprowski , =?utf-8?q?=C5=81ukasz_Stelmach?= Subject: [PATCH v3] hwrng: exynos - Fix runtime PM imbalance on error Date: Wed, 5 May 2021 20:29:14 +0200 Message-Id: <20210505182914.13394-1-l.stelmach@samsung.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Organization: Samsung R&D Institute Poland X-Brightmail-Tracker: H4sIAAAAAAAAA01SaUwTYRDNt7uUpUlxKUYmQD0a+SGJgEbNJihKorGJJuKBP4xEVlkBobW2 okgUiQoaRapYFVutqChXEVpwRdCi9aBqFOsBSEBpSiIWRAUP8KDSLkb/zXvz3sy8ZEhcfMkn mExVbGdVCiZd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918eucas1p18a11263e5d214e3356ac65d79504e430 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20210505182918eucas1p18a11263e5d214e3356ac65d79504e430 References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210505_112925_349766_EC412A8B X-CRM114-Status: GOOD ( 15.13 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org pm_runtime_resume_and_get() wraps around pm_runtime_get_sync() and decrements the runtime PM usage counter in case the latter function fails and keeps the counter balanced. Signed-off-by: Ɓukasz Stelmach Reviewed-by: Krzysztof Kozlowski --- Changes in v3: - use pm_runtime_resume_and_get() Changes in v2: - removed Change-Id from the commit message drivers/char/hw_random/exynos-trng.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c index 8e1fe3f8dd2d..c8db62bc5ff7 100644 --- a/drivers/char/hw_random/exynos-trng.c +++ b/drivers/char/hw_random/exynos-trng.c @@ -132,7 +132,7 @@ static int exynos_trng_probe(struct platform_device *pdev) return PTR_ERR(trng->mem); pm_runtime_enable(&pdev->dev); - ret = pm_runtime_get_sync(&pdev->dev); + ret = pm_runtime_resume_and_get(&pdev->dev); if (ret < 0) { dev_err(&pdev->dev, "Could not get runtime PM.\n"); goto err_pm_get; @@ -165,7 +165,7 @@ static int exynos_trng_probe(struct platform_device *pdev) clk_disable_unprepare(trng->clk); err_clock: - pm_runtime_put_sync(&pdev->dev); + pm_runtime_put_noidle(&pdev->dev); err_pm_get: pm_runtime_disable(&pdev->dev);