Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1355668

[PATCH 4/5] hwrng: exynos - Disable runtime PM on probe failure

From Krzysztof Kozlowski <k.kozlowski@samsung.com>
Newsgroups linux.kernel
Subject [PATCH 4/5] hwrng: exynos - Disable runtime PM on probe failure
Date 2016-03-11 09:00 +0100
Message-ID <rbq9k-2WM-7@gated-at.bofh.it> (permalink)
References <rbpZD-2SL-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <k.kozlowski@samsung.com>
---
 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)
-- 
2.5.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/5] hwrng: exynos - Hide PM functions with __maybe_unused Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-03-11 08:50 +0100
  [PATCH 5/5] hwrng: exynos - Disable runtime PM on driver unbind Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-03-11 09:00 +0100
    Re: [PATCH 5/5] hwrng: exynos - Disable runtime PM on driver unbind Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-03-12 06:30 +0100
  [PATCH 4/5] hwrng: exynos - Disable runtime PM on probe failure Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-03-11 09:00 +0100
  [PATCH 3/5] hwrng: exynos - Fix unbalanced PM runtime put on timeout  error path Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-03-11 09:00 +0100
  [PATCH 2/5] hwrng: exynos - Runtime suspend device after init Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-03-11 09:00 +0100
  Re: [PATCH 1/5] hwrng: exynos - Hide PM functions with __maybe_unused Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-03-12 06:00 +0100

csiph-web