Commit 984798de authored by Jonas Gorski's avatar Jonas Gorski Committed by Herbert Xu

hwrng: bcm2835 - fix probe as platform device

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: 8705f24f ("hwrng: bcm2835 - Enable BCM2835 RNG to work on BCM63xx platforms")
Signed-off-by: default avatarJonas Gorski <jonas.gorski@gmail.com>
Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent ef5c73b3
......@@ -168,6 +168,7 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
priv->rng.read = bcm2835_rng_read;
priv->rng.cleanup = bcm2835_rng_cleanup;
if (dev_of_node(dev)) {
rng_id = of_match_node(bcm2835_rng_of_match, np);
if (!rng_id)
return -EINVAL;
......@@ -176,6 +177,7 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
of_data = rng_id->data;
if (of_data)
priv->mask_interrupts = of_data->mask_interrupts;
}
/* register driver */
err = devm_hwrng_register(dev, &priv->rng);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment