Skip to content

Commit 984798d

Browse files
KanjiMonsterherbertx
authored andcommitted
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: 8705f24 ("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> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent ef5c73b commit 984798d

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

‎drivers/char/hw_random/bcm2835-rng.c‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,16 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
168168
priv->rng.read = bcm2835_rng_read;
169169
priv->rng.cleanup = bcm2835_rng_cleanup;
170170

171-
rng_id = of_match_node(bcm2835_rng_of_match, np);
172-
if (!rng_id)
173-
return -EINVAL;
174-
175-
/* Check for rng init function, execute it */
176-
of_data = rng_id->data;
177-
if (of_data)
178-
priv->mask_interrupts = of_data->mask_interrupts;
171+
if (dev_of_node(dev)) {
172+
rng_id = of_match_node(bcm2835_rng_of_match, np);
173+
if (!rng_id)
174+
return -EINVAL;
175+
176+
/* Check for rng init function, execute it */
177+
of_data = rng_id->data;
178+
if (of_data)
179+
priv->mask_interrupts = of_data->mask_interrupts;
180+
}
179181

180182
/* register driver */
181183
err = devm_hwrng_register(dev, &priv->rng);

0 commit comments

Comments
 (0)