diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2013-09-25 05:24:17 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2013-10-07 02:17:01 -0400 |
commit | d319fe2a0af3509f959d5195fb8916accbf14857 (patch) | |
tree | 284b5ea5a9ffe4536c30e41042ee58a697ea9822 /drivers/char/hw_random/pseries-rng.c | |
parent | 49cca7e047468f5f80970d635b54afabeb441cce (diff) |
hwrng: pseries - Return errors to upper levels in pseries-rng.c
We don't expect to get errors from the hypervisor when reading the rng,
but if we do we should pass the error up to the hwrng driver. Otherwise
the hwrng driver will continue calling us forever.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/char/hw_random/pseries-rng.c')
-rw-r--r-- | drivers/char/hw_random/pseries-rng.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/char/hw_random/pseries-rng.c b/drivers/char/hw_random/pseries-rng.c index 9dbeed391e57..ab7ffdec0ec3 100644 --- a/drivers/char/hw_random/pseries-rng.c +++ b/drivers/char/hw_random/pseries-rng.c | |||
@@ -17,6 +17,9 @@ | |||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
21 | |||
22 | #include <linux/kernel.h> | ||
20 | #include <linux/module.h> | 23 | #include <linux/module.h> |
21 | #include <linux/hw_random.h> | 24 | #include <linux/hw_random.h> |
22 | #include <asm/vio.h> | 25 | #include <asm/vio.h> |
@@ -24,10 +27,15 @@ | |||
24 | 27 | ||
25 | static int pseries_rng_data_read(struct hwrng *rng, u32 *data) | 28 | static int pseries_rng_data_read(struct hwrng *rng, u32 *data) |
26 | { | 29 | { |
27 | if (plpar_hcall(H_RANDOM, (unsigned long *)data) != H_SUCCESS) { | 30 | int rc; |
28 | printk(KERN_ERR "pseries rng hcall error\n"); | 31 | |
29 | return 0; | 32 | rc = plpar_hcall(H_RANDOM, (unsigned long *)data); |
33 | if (rc != H_SUCCESS) { | ||
34 | pr_err_ratelimited("H_RANDOM call failed %d\n", rc); | ||
35 | return -EIO; | ||
30 | } | 36 | } |
37 | |||
38 | /* The hypervisor interface returns 64 bits */ | ||
31 | return 8; | 39 | return 8; |
32 | } | 40 | } |
33 | 41 | ||