From patchwork Mon Mar 14 00:07:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 8574401 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8C4139F6E1 for ; Mon, 14 Mar 2016 00:08:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BA2182044C for ; Mon, 14 Mar 2016 00:08:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F2A522045E for ; Mon, 14 Mar 2016 00:08:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932989AbcCNAHu (ORCPT ); Sun, 13 Mar 2016 20:07:50 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:16400 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754566AbcCNAHh (ORCPT ); Sun, 13 Mar 2016 20:07:37 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O40000L15OK3V80@mailout1.w1.samsung.com>; Mon, 14 Mar 2016 00:07:32 +0000 (GMT) X-AuditID: cbfec7f4-f79026d00000418a-2c-56e600c4a693 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 50.FA.16778.4C006E65; Mon, 14 Mar 2016 00:07:32 +0000 (GMT) Received: from localhost.localdomain ([10.113.63.52]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O4000AG95O6YG70@eusync4.samsung.com>; Mon, 14 Mar 2016 00:07:32 +0000 (GMT) From: Krzysztof Kozlowski To: Matt Mackall , Herbert Xu , Kukjin Kim , linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Alan Stern , Krzysztof Kozlowski Subject: [PATCH v2 3/4] hwrng: exynos - Disable runtime PM on probe failure Date: Mon, 14 Mar 2016 09:07:14 +0900 Message-id: <1457914035-26856-3-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 2.5.0 In-reply-to: <1457914035-26856-1-git-send-email-k.kozlowski@samsung.com> References: <1457914035-26856-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrMLMWRmVeSWpSXmKPExsVy+t/xa7pHGJ6FGWxpY7HofiVj8fqFoUX/ 49fMFpseX2O1uH/vJ5PF5V1z2CxmnN/HZLFgWx+jxYTfF9gcOD22HVD12LSqk81j85J6j9l3 fzB69G1ZBSRebmD0+LxJLoA9issmJTUnsyy1SN8ugSvj/uGygj7uilVnD7I1MG7l7GLk5JAQ MJH4seIDE4QtJnHh3nq2LkYuDiGBpYwSMx4cY4Vw/jNKbP7bClbFJmAssXn5ErAqEYFvjBI/ Hp5jBEkwC0RLvOp9BGYLC3hLHDs2mw3EZhFQlbjf3gvWzCvgLvHz8T0gmwNonZzEggvpIGFO AQ+JQyvWs4PYQkAlF/Z+Zp/AyLuAkWEVo2hqaXJBcVJ6rqFecWJucWleul5yfu4mRkjQfdnB uPiY1SFGAQ5GJR7eH2uehgmxJpYVV+YeYpTgYFYS4Z33HyjEm5JYWZValB9fVJqTWnyIUZqD RUmcd+6u9yFCAumJJanZqakFqUUwWSYOTqkGRrWfaUcmPTS6elOnKkPdNOfPtMeL27Nvtjck b1+0KKqB+/a862u3OuUXZ7bbzJfd8rr5QwGnDKttiE77pOunPvz44Ti7TWXumdMKyWYr5h7J XBm9tN3E6lSTdXhM5+swr+7W5dGhoStYUsLYco3658f2y87JZ5+X/L/kzsKzHPxhrUe2JfZs VGIpzkg01GIuKk4EAGqVLcw2AgAA Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add proper error path (for disabling runtime PM) when registering of hwrng fails. Fixes: b329669ea0b5 ("hwrng: exynos - Add support for Exynos random number generator") Signed-off-by: Krzysztof Kozlowski --- Changes since v1: 1. Call also pm_runtime_dont_use_autosuspend() to revert everything set during probe. --- drivers/char/hw_random/exynos-rng.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/char/hw_random/exynos-rng.c b/drivers/char/hw_random/exynos-rng.c index 38b80f82ddd2..71b45b153cf2 100644 --- a/drivers/char/hw_random/exynos-rng.c +++ b/drivers/char/hw_random/exynos-rng.c @@ -119,6 +119,7 @@ static int exynos_rng_probe(struct platform_device *pdev) { struct exynos_rng *exynos_rng; struct resource *res; + int ret; exynos_rng = devm_kzalloc(&pdev->dev, sizeof(struct exynos_rng), GFP_KERNEL); @@ -146,7 +147,13 @@ static int exynos_rng_probe(struct platform_device *pdev) pm_runtime_use_autosuspend(&pdev->dev); pm_runtime_enable(&pdev->dev); - return devm_hwrng_register(&pdev->dev, &exynos_rng->rng); + ret = devm_hwrng_register(&pdev->dev, &exynos_rng->rng); + if (ret) { + pm_runtime_dont_use_autosuspend(&pdev->dev); + pm_runtime_disable(&pdev->dev); + } + + return ret; } static int __maybe_unused exynos_rng_runtime_suspend(struct device *dev)