From patchwork Thu Apr 22 10:41:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lukasz Stelmach X-Patchwork-Id: 12218211 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=-16.8 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,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 78166C43470 for ; Thu, 22 Apr 2021 10:43:48 +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 D5C2861463 for ; Thu, 22 Apr 2021 10:43:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D5C2861463 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=ET+dPShlK4BwFwxMxnmtmHFAErmgG0hIBuPx3iEI75U=; b=VuG2s85m3uFOuFf5nyq2RXzaM 9MLLFNLWqFuKQ0sde/wJCGNA32ZkXN8gV1Z0dHKACSu+cyy0gr7Fu/JnTmt/KIc/AGikwUG43OL3l Y2rIFu87SgDErn5JQ//vsvjGmM5h0NI53ZiCI/U5g2xsM/U8R5YfHmGquhiCkwrl1s2D3n30WugLl 1Y3+nAbbp4pSDWHmKBbAN8fKSSslJjKf97LJRUyaGroqtZWGJgSibzXKktbD0DPsxr77GlJTOMRgG /Zikvl3mJXeg7gLhxpSL+eGvJJairdjPq99ln1vv0KA+JAVP/gCrVS9hK5HFTgLU4CLPnnfQsTUFg TXr9qx+4A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lZWmV-00GUyF-80; Thu, 22 Apr 2021 10:41:59 +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 1lZWmQ-00GUxx-M4 for linux-arm-kernel@desiato.infradead.org; Thu, 22 Apr 2021 10:41:55 +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=jbZRehNx5NXEaCH90SwTt765oxUjcpQrES5K/+JgKcs=; b=gsomt9Ip90mkf1ts04dwvH15xR A2VUgdY2AkBUT19mEL5nJ835BVomW1jJVEMz7YViSHCfZBSX+EOFuJWcXvuVcJ2hZwMtBn0n0A2LH DsA1lGODt470+fv41PnEsaDm2etsBkzRNYVEX0gHWoy8/AIE1IEpvaHSFPoTdXzmpg95gOh+NT/MJ BCRV6zrEBTmIYPl4tGdKhhzvqhUvINVV2bQFnlZkENQT71CpM4EuS4mWrHGx/igXYjklAeDu9JATr hvgPb7VGqoienq7osP9msXk5XOcd30qTeHNOWoUhiqL5VfzJoynoB6lFkx4BKRG9PQZ/TD3sKHqt4 gNUuzyJw==; Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZWmM-00DaTZ-2h for linux-arm-kernel@lists.infradead.org; Thu, 22 Apr 2021 10:41:52 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20210422104146euoutp01f3a49ae317f5eb4c4bad27b5d2994896~4KA4AankH1308313083euoutp01O for ; Thu, 22 Apr 2021 10:41:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20210422104146euoutp01f3a49ae317f5eb4c4bad27b5d2994896~4KA4AankH1308313083euoutp01O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1619088106; bh=jbZRehNx5NXEaCH90SwTt765oxUjcpQrES5K/+JgKcs=; h=From:To:Cc:Subject:Date:References:From; b=RC0ycAaB9RzBmBCUMVFP5uvtV2JJsgtmGffcCaMjjSvVXUSuuGLobBGpBUHzR3GMI CyyKlxOK+4/oVYUrGqp+W3cWdRtFhe401Z7oIERDSVoOZTax8Z/0O4isUO6P43MyK9 42uygVv/PzHt7IzWi3ldNY34oei9QJRoGLVydUNo= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20210422104146eucas1p105a060bb3b260394d6e9d661b4e513d1~4KA3djRMI1752617526eucas1p17; Thu, 22 Apr 2021 10:41:46 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id B1.6F.09444.9E251806; Thu, 22 Apr 2021 11:41:45 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20210422104145eucas1p17f46c95b72f3568761a9f7911bf072e1~4KA2tkWOq2196621966eucas1p1k; Thu, 22 Apr 2021 10:41:45 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210422104145eusmtrp108e515d4b629345d47725dd03e17eb58~4KA2sxvw81696216962eusmtrp1U; Thu, 22 Apr 2021 10:41:45 +0000 (GMT) X-AuditID: cbfec7f4-dbdff700000024e4-ce-608152e9da60 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id C0.07.08705.9E251806; Thu, 22 Apr 2021 11:41:45 +0100 (BST) Received: from localhost (unknown [106.120.51.46]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210422104145eusmtip1fe9f73fb1e323c14c358b06019056b95~4KA2fnx0d3135731357eusmtip1P; Thu, 22 Apr 2021 10:41:44 +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 v2] hwrng: exynos - Fix runtime PM imbalance on error Date: Thu, 22 Apr 2021 12:41:41 +0200 Message-Id: <20210422104141.17668-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: H4sIAAAAAAAAA+NgFlrEKsWRmVeSWpSXmKPExsWy7djP87ovgxoTDJ7+sLTYOGM9q0X3KxmL jW9/MFncPLSC0WLT42usFvfv/WSyuLxrDpvFjPP7mCzWHrnLbrFgWx+jA5fHrIZeNo9tB1Q9 Ni+p9+jbsorRo+/lBkaPz5v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FncPLSC0WLT42usFvfv/WSyuLxrDpvFjPP7mCzWHrnLbrFgWx+jA5fHrIZeNo9tB1Q9 Ni+p9+jbsorRo+/lBkaPz5vkAtii9GyK8ktLUhUy8otLbJWiDS2M9AwtLfSMTCz1DI3NY62M TJX07WxSUnMyy1KL9O0S9DLuXs8paOSuWNDynLmBcQpnFyMnh4SAiUTHpQnsXYxcHEICSxkl tr4+xtrFyAGUkJJYOTcdokZY4s+1LjaImqeMEhO/3mAGSbAJOEr0Lz3BCpIQEZjGJHF22Skw h1lgH6PE/qOL2UGqhAVcJdonX2ACsVkEVCVOb7sIFucVsJZ42DWbFWKFvET78u1sEHFBiZMz n7CAXMEsoC6xfp4QSJhfQEtiTdN1FhCbGai8eets5gmMArOQdMxC6JiFpGoBI/MqRpHU0uLc 9NxiQ73ixNzi0rx0veT83E2MwFjaduzn5h2M81591DvEyMTBeIhRgoNZSYR3bXFDghBvSmJl VWpRfnxRaU5q8SFGU6APJjJLiSbnA6M5ryTe0MzA1NDEzNLA1NLMWEmcd+vcNfFCAumJJanZ qakFqUUwfUwcnFINTEGX1WxUw5uWBLw72ejAyeX2ddOpu4375As9HzL6/dgVvtZ5qdXiz+08 k7JE7nQqf8rPsy+evX65bHTY+pSmuPqQ5XMDV/J/ZNj1xlzqpSKnutmNp0dufnJTkQzd8EKg 1WuBz+nJvIufsLWK7vSS73jHUi/MzeN5zpI1f+nSRNcgnc6MUFMr/+XNepddjnQ6/V3U3zQ9 U21bT1bQ5mCmjAzbK3/ZVk4PPzEptvnkj4DHH92M7qZM+2lmPedp8/WeV5494RN5Z/U2+nHH rG0ulPiSs91cTHi+wUfGV6dPXYrtn57scPUf7+rAxO+enjks39bwntBWiFX+PIlr4tyWJlf+ pRuK/VS5vUWLf59SYinOSDTUYi4qTgQARow6/i4DAAA= X-CMS-MailID: 20210422104145eucas1p17f46c95b72f3568761a9f7911bf072e1 X-Msg-Generator: CA X-RootMTR: 20210422104145eucas1p17f46c95b72f3568761a9f7911bf072e1 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20210422104145eucas1p17f46c95b72f3568761a9f7911bf072e1 References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210422_034150_652954_5FA2DBF7 X-CRM114-Status: GOOD ( 14.56 ) 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_get_sync() increments the runtime PM usage counter even the call returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced. Signed-off-by: Ɓukasz Stelmach --- Changes in v2: - removed Change-Id from the commit message drivers/char/hw_random/exynos-trng.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c index 8e1fe3f8dd2d..9f455d952e87 100644 --- a/drivers/char/hw_random/exynos-trng.c +++ b/drivers/char/hw_random/exynos-trng.c @@ -142,13 +142,13 @@ static int exynos_trng_probe(struct platform_device *pdev) if (IS_ERR(trng->clk)) { ret = PTR_ERR(trng->clk); dev_err(&pdev->dev, "Could not get clock.\n"); - goto err_clock; + goto err_pm_get; } ret = clk_prepare_enable(trng->clk); if (ret) { dev_err(&pdev->dev, "Could not enable the clk.\n"); - goto err_clock; + goto err_pm_get; } ret = devm_hwrng_register(&pdev->dev, &trng->rng); @@ -164,10 +164,8 @@ static int exynos_trng_probe(struct platform_device *pdev) err_register: clk_disable_unprepare(trng->clk); -err_clock: - pm_runtime_put_sync(&pdev->dev); - err_pm_get: + pm_runtime_put_noidle(&pdev->dev); pm_runtime_disable(&pdev->dev); return ret;