* [PATCH] hwrng: bcm2835 - fix probe as platform device
@ 2019-02-19 12:16 Jonas Gorski
2019-02-19 18:52 ` Florian Fainelli
2019-02-28 6:29 ` Herbert Xu
0 siblings, 2 replies; 3+ messages in thread
From: Jonas Gorski @ 2019-02-19 12:16 UTC (permalink / raw)
To: linux-crypto, linux-kernel
Cc: Florian Fainelli, Matt Mackall, Herbert Xu, Arnd Bergmann,
Greg Kroah-Hartman, Ray Jui, Scott Branden,
bcm-kernel-feedback-list, Eric Anholt, Stefan Wahren
BCM63XX (MIPS) does not use device tree, so there cannot be any
of_device_id, causing the driver to fail on probe:
[ 0.904564] bcm2835-rng: probe of bcm63xx-rng failed with error -22
Fix this by checking for match data only if we are probing from device
tree.
Fixes: 8705f24f7b57 ("hwrng: bcm2835 - Enable BCM2835 RNG to work on BCM63xx platforms")
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
drivers/char/hw_random/bcm2835-rng.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
index 256b0b1d0f26..f759790c3cdb 100644
--- a/drivers/char/hw_random/bcm2835-rng.c
+++ b/drivers/char/hw_random/bcm2835-rng.c
@@ -168,14 +168,16 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
priv->rng.read = bcm2835_rng_read;
priv->rng.cleanup = bcm2835_rng_cleanup;
- rng_id = of_match_node(bcm2835_rng_of_match, np);
- if (!rng_id)
- return -EINVAL;
-
- /* Check for rng init function, execute it */
- of_data = rng_id->data;
- if (of_data)
- priv->mask_interrupts = of_data->mask_interrupts;
+ if (dev_of_node(dev)) {
+ rng_id = of_match_node(bcm2835_rng_of_match, np);
+ if (!rng_id)
+ return -EINVAL;
+
+ /* Check for rng init function, execute it */
+ of_data = rng_id->data;
+ if (of_data)
+ priv->mask_interrupts = of_data->mask_interrupts;
+ }
/* register driver */
err = devm_hwrng_register(dev, &priv->rng);
--
2.13.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] hwrng: bcm2835 - fix probe as platform device
2019-02-19 12:16 [PATCH] hwrng: bcm2835 - fix probe as platform device Jonas Gorski
@ 2019-02-19 18:52 ` Florian Fainelli
2019-02-28 6:29 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2019-02-19 18:52 UTC (permalink / raw)
To: Jonas Gorski, linux-crypto, linux-kernel
Cc: Matt Mackall, Herbert Xu, Arnd Bergmann, Greg Kroah-Hartman,
Ray Jui, Scott Branden, bcm-kernel-feedback-list, Eric Anholt,
Stefan Wahren
On 2/19/19 4:16 AM, Jonas Gorski wrote:
> BCM63XX (MIPS) does not use device tree, so there cannot be any
> of_device_id, causing the driver to fail on probe:
>
> [ 0.904564] bcm2835-rng: probe of bcm63xx-rng failed with error -22
>
> Fix this by checking for match data only if we are probing from device
> tree.
>
> Fixes: 8705f24f7b57 ("hwrng: bcm2835 - Enable BCM2835 RNG to work on BCM63xx platforms")
> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Sorry about that, thanks for the fix!
--
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] hwrng: bcm2835 - fix probe as platform device
2019-02-19 12:16 [PATCH] hwrng: bcm2835 - fix probe as platform device Jonas Gorski
2019-02-19 18:52 ` Florian Fainelli
@ 2019-02-28 6:29 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2019-02-28 6:29 UTC (permalink / raw)
To: Jonas Gorski
Cc: linux-crypto, linux-kernel, Florian Fainelli, Matt Mackall,
Arnd Bergmann, Greg Kroah-Hartman, Ray Jui, Scott Branden,
bcm-kernel-feedback-list, Eric Anholt, Stefan Wahren
On Tue, Feb 19, 2019 at 01:16:08PM +0100, Jonas Gorski wrote:
> BCM63XX (MIPS) does not use device tree, so there cannot be any
> of_device_id, causing the driver to fail on probe:
>
> [ 0.904564] bcm2835-rng: probe of bcm63xx-rng failed with error -22
>
> Fix this by checking for match data only if we are probing from device
> tree.
>
> Fixes: 8705f24f7b57 ("hwrng: bcm2835 - Enable BCM2835 RNG to work on BCM63xx platforms")
> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
> ---
> drivers/char/hw_random/bcm2835-rng.c | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-28 6:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-19 12:16 [PATCH] hwrng: bcm2835 - fix probe as platform device Jonas Gorski
2019-02-19 18:52 ` Florian Fainelli
2019-02-28 6:29 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).