staging: unisys: visorchannel_write(): Use memcpy_toio() directly
authorJes Sorensen <Jes.Sorensen@redhat.com>
Tue, 5 May 2015 22:36:54 +0000 (18:36 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 May 2015 13:27:29 +0000 (15:27 +0200)
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/unisys/visorbus/visorchannel.c

index bf2f17ac8e970467bdb3162a831355ecb677664f..bf75aa075b7456f92e5ebaf8f479eb0ec6539468 100644 (file)
@@ -216,10 +216,15 @@ visorchannel_write(struct visorchannel *channel, ulong offset,
 {
        size_t size = sizeof(struct channel_header);
 
+       if (offset + nbytes > channel->memregion.nbytes)
+               return -EIO;
+
        if (!offset && nbytes >= size)
                memcpy(&channel->chan_hdr, local, size);
-       return visor_memregion_write(&channel->memregion,
-                                    offset, local, nbytes);
+
+       memcpy_toio(channel->memregion.mapped + offset, local, nbytes);
+
+       return 0;
 }
 EXPORT_SYMBOL_GPL(visorchannel_write);