From patchwork Fri Mar 11 07:49:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 8562791 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 4C6789F46A for ; Fri, 11 Mar 2016 07:50:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8168C2026D for ; Fri, 11 Mar 2016 07:50:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A566C20268 for ; Fri, 11 Mar 2016 07:50:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934572AbcCKHt7 (ORCPT ); Fri, 11 Mar 2016 02:49:59 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:65420 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934259AbcCKHtr (ORCPT ); Fri, 11 Mar 2016 02:49:47 -0500 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O3V00D3H72WID50@mailout1.w1.samsung.com>; Fri, 11 Mar 2016 07:49:44 +0000 (GMT) X-AuditID: cbfec7f5-f79b16d000005389-70-56e278970fb5 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 7D.5F.21385.79872E65; Fri, 11 Mar 2016 07:49:43 +0000 (GMT) Received: from localhost.localdomain ([10.113.63.52]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O3V00KWE72HYU40@eusync2.samsung.com>; Fri, 11 Mar 2016 07:49:43 +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: Krzysztof Kozlowski Subject: [PATCH 4/5] hwrng: exynos - Disable runtime PM on probe failure Date: Fri, 11 Mar 2016 16:49:21 +0900 Message-id: <1457682562-21219-4-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 2.5.0 In-reply-to: <1457682562-21219-1-git-send-email-k.kozlowski@samsung.com> References: <1457682562-21219-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprFLMWRmVeSWpSXmKPExsVy+t/xK7rTKx6FGUxusrTofiVj8fqFoUX/ 49fMFpseX2O1uH/vJ5PF5V1z2CxmnN/HZLFgWx+jA4fHtgOqHptWdbJ5bF5S79G3ZRWjR9/L DYwenzfJBbBFcdmkpOZklqUW6dslcGXs+7eEreAuZ8XHJT+ZGxiXcnQxcnJICJhIzNvyiRXC FpO4cG89WxcjF4eQwFJGiWP/vrJCOP8ZJfa93soGUsUmYCyxefkSsCoRgW+MEj8enmMESTAL GEr8fPeHHcQWFvCQmL/lFFicRUBVYtP/RrBmXgF3id/37jN1MXIArZOTWHAhHSTMCVTeuOUT WIkQUMnKm0fZJjDyLmBkWMUomlqaXFCclJ5rpFecmFtcmpeul5yfu4kREmJfdzAuPWZ1iFGA g1GJh/fDtYdhQqyJZcWVuYcYJTiYlUR4M4sfhQnxpiRWVqUW5ccXleakFh9ilOZgURLnnbnr fYiQQHpiSWp2ampBahFMlomDU6qBMaz+l4G7U1ZS5t3O+ZzXuMMOlPc/uLdR/k6RXesjgx8n 9krIVHD6JEQ+LujVDOO7wvBiVjTv3pbXOziFajwZvA22Wez9v6rJUt44bedyv80HypNZJ9dc rjHR7Jx/6n31h5nNa3+csm2NrPS/l6e7vPyp0MzomDd1TQJbt9Qsj2bg5Nfh91mlxFKckWio xVxUnAgA03cddi0CAAA= 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 --- drivers/char/hw_random/exynos-rng.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/char/hw_random/exynos-rng.c b/drivers/char/hw_random/exynos-rng.c index 38b80f82ddd2..68c349bf66a0 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,11 @@ 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_disable(&pdev->dev); + + return ret; } static int __maybe_unused exynos_rng_runtime_suspend(struct device *dev)