hwrng: bcm2835 - Handle deferred clock properly
authorStefan Wahren <stefan.wahren@i2se.com>
Mon, 12 Feb 2018 20:11:36 +0000 (21:11 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 22 Feb 2018 14:16:21 +0000 (22:16 +0800)
In case the probe of the clock is deferred, we would assume it is
optional. This is wrong, so defer the probe of this driver until
the clock is available.

Fixes: 791af4f4907a ("hwrng: bcm2835 - Manage an optional clock")
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/bcm2835-rng.c

index 7a84cec30c3a2e10bf77f69ccdee5e61b47c8021..6767d965c36c5254e052c84d1b9577af7c0ca5e1 100644 (file)
@@ -163,6 +163,8 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
 
        /* Clock is optional on most platforms */
        priv->clk = devm_clk_get(dev, NULL);
+       if (IS_ERR(priv->clk) && PTR_ERR(priv->clk) == -EPROBE_DEFER)
+               return -EPROBE_DEFER;
 
        priv->rng.name = pdev->name;
        priv->rng.init = bcm2835_rng_init;