[PATCH 1/2] virtio-rng: cope if struct hwrng.name is changed to const

From: Stephen Rothwell
Date: Thu May 15 2014 - 01:34:27 EST



Signed-off-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
---
drivers/char/hw_random/virtio-rng.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

Based on the current virtio tree in linux-next.

diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
index 12e242bbb0f5..6319b133b7aa 100644
--- a/drivers/char/hw_random/virtio-rng.c
+++ b/drivers/char/hw_random/virtio-rng.c
@@ -94,9 +94,11 @@ static int probe_common(struct virtio_device *vdev)
{
int err, i;
struct virtrng_info *vi = NULL;
+ char *name;

vi = kmalloc(sizeof(struct virtrng_info), GFP_KERNEL);
- vi->hwrng.name = kmalloc(40, GFP_KERNEL);
+ name = kmalloc(40, GFP_KERNEL);
+ vi->hwrng.name = name;
init_completion(&vi->have_data);

vi->hwrng.read = virtio_read;
@@ -117,7 +119,7 @@ static int probe_common(struct virtio_device *vdev)

i = 0;
do {
- sprintf(vi->hwrng.name, "virtio_rng.%d", i++);
+ sprintf(name, "virtio_rng.%d", i++);
err = hwrng_register(&vi->hwrng);
} while (err == -EEXIST);

--
2.0.0.rc2

--
Cheers,
Stephen Rothwell sfr@xxxxxxxxxxxxxxxx

Attachment: signature.asc
Description: PGP signature