diff options
Diffstat (limited to 'drivers/hw_random/stm32-rng.c')
-rw-r--r-- | drivers/hw_random/stm32-rng.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/hw_random/stm32-rng.c b/drivers/hw_random/stm32-rng.c index 440b53684f..03bc4a5cbf 100644 --- a/drivers/hw_random/stm32-rng.c +++ b/drivers/hw_random/stm32-rng.c @@ -51,7 +51,7 @@ static int stm32_rng_read(struct hwrng *hwrng, void *data, size_t len, bool wait ret = readl_poll_timeout(rng->base + RNG_SR, sr, sr & RNG_SR_DRDY, 10 * USEC_PER_MSEC); if (ret) - goto out; + return ret; if (sr & (RNG_SR_SEIS | RNG_SR_SECS)) { int i; @@ -61,8 +61,7 @@ static int stm32_rng_read(struct hwrng *hwrng, void *data, size_t len, bool wait readl(rng->base + RNG_DR); if (readl(rng->base + RNG_SR) & RNG_SR_SEIS) { pr_warn("RNG Noise"); - ret = -EIO; - goto out; + return -EIO; } /* start again */ @@ -84,8 +83,7 @@ static int stm32_rng_read(struct hwrng *hwrng, void *data, size_t len, bool wait } } -out: - return len ?: ret; + return len; } static int stm32_rng_init(struct hwrng *hwrng) @@ -106,7 +104,7 @@ static int stm32_rng_init(struct hwrng *hwrng) return 0; } -static void stm32_rng_remove(struct device_d *dev) +static void stm32_rng_remove(struct device *dev) { struct stm32_rng *rng = dev->priv; @@ -114,7 +112,7 @@ static void stm32_rng_remove(struct device_d *dev) clk_disable(rng->clk); } -static int stm32_rng_probe(struct device_d *dev) +static int stm32_rng_probe(struct device *dev) { struct stm32_rng *rng; struct resource *res; @@ -154,8 +152,9 @@ static const struct of_device_id stm32_rng_dt_ids[] = { { .compatible = "st,stm32-rng" }, { /* sentinel */}, }; +MODULE_DEVICE_TABLE(of, stm32_rng_dt_ids); -static struct driver_d stm32_rng_driver = { +static struct driver stm32_rng_driver = { .name = "stm32-rng", .probe = stm32_rng_probe, .remove = stm32_rng_remove, |