Staging: comedi: adl_pci9118: Fix endian sparse warning
authorKsenija Stanojevic <ksenija.stanojevic@gmail.com>
Sat, 31 Oct 2015 13:36:44 +0000 (06:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 16 Nov 2015 04:02:47 +0000 (20:02 -0800)
Fix following sparse warning:
warning: cast to restricted __be16

data is pointer of type void and can be used to store any type of data.
barray and array have the same 16 bit offset.

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/adl_pci9118.c

index 0dff1dbb53fbff396482e857e8bcbbfcdf6bfdef..4437ea3abe8d04ac4946307b0f42b0c4c7360253 100644 (file)
@@ -603,10 +603,11 @@ static void pci9118_ai_munge(struct comedi_device *dev,
        unsigned short *array = data;
        unsigned int num_samples = comedi_bytes_to_samples(s, num_bytes);
        unsigned int i;
+       __be16 *barray = data;
 
        for (i = 0; i < num_samples; i++) {
                if (devpriv->usedma)
-                       array[i] = be16_to_cpu(array[i]);
+                       array[i] = be16_to_cpu(barray[i]);
                if (s->maxdata == 0xffff)
                        array[i] ^= 0x8000;
                else