Commit b4dc3a3a authored by Michael Ellerman's avatar Michael Ellerman Committed by Jiri Slaby

hwrng: pseries - Return errors to upper levels in pseries-rng.c

commit d319fe2a upstream.

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: default avatarMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 1c854a6c
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/hw_random.h> #include <linux/hw_random.h>
#include <asm/vio.h> #include <asm/vio.h>
...@@ -25,10 +28,15 @@ ...@@ -25,10 +28,15 @@
static int pseries_rng_data_read(struct hwrng *rng, u32 *data) static int pseries_rng_data_read(struct hwrng *rng, u32 *data)
{ {
if (plpar_hcall(H_RANDOM, (unsigned long *)data) != H_SUCCESS) { int rc;
printk(KERN_ERR "pseries rng hcall error\n");
return 0; rc = plpar_hcall(H_RANDOM, (unsigned long *)data);
if (rc != H_SUCCESS) {
pr_err_ratelimited("H_RANDOM call failed %d\n", rc);
return -EIO;
} }
/* The hypervisor interface returns 64 bits */
return 8; return 8;
} }
......
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