summaryrefslogtreecommitdiffstats
path: root/bcm2835-hwrng-Handle-deferred-clock-properly.patch
diff options
context:
space:
mode:
Diffstat (limited to 'bcm2835-hwrng-Handle-deferred-clock-properly.patch')
-rw-r--r--bcm2835-hwrng-Handle-deferred-clock-properly.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/bcm2835-hwrng-Handle-deferred-clock-properly.patch b/bcm2835-hwrng-Handle-deferred-clock-properly.patch
new file mode 100644
index 000000000..4b4cdfea0
--- /dev/null
+++ b/bcm2835-hwrng-Handle-deferred-clock-properly.patch
@@ -0,0 +1,42 @@
+From patchwork Mon Feb 12 20:11:36 2018
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: hwrng: bcm2835: Handle deferred clock properly
+From: Stefan Wahren <stefan.wahren@i2se.com>
+X-Patchwork-Id: 10214385
+Message-Id: <1518466296-30161-1-git-send-email-stefan.wahren@i2se.com>
+To: Herbert Xu <herbert@gondor.apana.org.au>, Matt Mackall <mpm@selenic.com>
+Cc: Stefan Wahren <stefan.wahren@i2se.com>,
+ Florian Fainelli <f.fainelli@gmail.com>, Arnd Bergmann <arnd@arndb.de>,
+ Scott Branden <sbranden@broadcom.com>, Jon Mason <jonmason@broadcom.com>,
+ Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
+ Eric Anholt <eric@anholt.net>,
+ bcm-kernel-feedback-list@broadcom.com, linux-crypto@vger.kernel.org,
+ Ray Jui <rjui@broadcom.com>, linux-arm-kernel@lists.infradead.org
+Date: Mon, 12 Feb 2018 21:11:36 +0100
+
+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>
+---
+ drivers/char/hw_random/bcm2835-rng.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
+index 7a84cec..6767d96 100644
+--- a/drivers/char/hw_random/bcm2835-rng.c
++++ b/drivers/char/hw_random/bcm2835-rng.c
+@@ -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;