]> git.hungrycats.org Git - linux/commitdiff
hwrng: exynos - Disable runtime PM on probe failure
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>
Mon, 14 Mar 2016 00:07:14 +0000 (09:07 +0900)
committerJiri Slaby <jslaby@suse.cz>
Thu, 29 Sep 2016 09:14:17 +0000 (11:14 +0200)
commit 48a61e1e2af8020f11a2b8f8dc878144477623c6 upstream.

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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/char/hw_random/exynos-rng.c

index 402ccfb625c516739b440f9a5fba76ff2c98e4d0..b6ec73f320d61fe3952f88a1b7f1ea91bb10cd31 100644 (file)
@@ -105,6 +105,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);
@@ -132,7 +133,13 @@ static int exynos_rng_probe(struct platform_device *pdev)
        pm_runtime_use_autosuspend(&pdev->dev);
        pm_runtime_enable(&pdev->dev);
 
-       return hwrng_register(&exynos_rng->rng);
+       ret = hwrng_register(&exynos_rng->rng);
+       if (ret) {
+               pm_runtime_dont_use_autosuspend(&pdev->dev);
+               pm_runtime_disable(&pdev->dev);
+       }
+
+       return ret;
 }
 
 static int exynos_rng_remove(struct platform_device *pdev)