[media] cx231xx-417: Fix a gcc warning
authorMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 7 Oct 2010 06:33:00 +0000 (03:33 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 21 Oct 2010 03:17:46 +0000 (01:17 -0200)
gcc didn't like to have i++ inside a complex operation:

drivers/media/video/cx231xx/cx231xx-417.c: In function ‘cx231xx_load_firmware’:
drivers/media/video/cx231xx/cx231xx-417.c:1059: warning: operation on ‘i’ may be undefined
drivers/media/video/cx231xx/cx231xx-417.c:1061: warning: operation on ‘i’ may be undefined
drivers/media/video/cx231xx/cx231xx-417.c:1063: warning: operation on ‘i’ may be undefined

Btw, I agree with gcc, as we're using i and i++ at the same operation and,
depending on how optimization may occur, it may produce a wrong code.

While here, fix CodingStyle issues on the changed code.

Acked-by: Sri Deevi <Srinivasa.Deevi@conexant.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx231xx/cx231xx-417.c

index a5b1b13d1fd62ed394789c2d67c6cd430051e782..b5b69989ff8d67cda3ed3f5851b93fd166d39048 100644 (file)
@@ -1053,16 +1053,15 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
        /*download the firmware by ep5-out*/
 
        for (frame = 0; frame < (int)(CX231xx_FIRM_IMAGE_SIZE*20/_buffer_size);
-               frame++) {
+            frame++) {
                for (i = 0; i < _buffer_size; i++) {
-                       *(p_buffer+i) =
-                       (u8)(*(p_fw+(frame*128*8+(i++/4))) & 0x000000FF);
-                       *(p_buffer+i) =
-                       (u8)((*(p_fw+(frame*128*8+(i++/4))) & 0x0000FF00)>>8);
-                       *(p_buffer+i) =
-                       (u8)((*(p_fw+(frame*128*8+(i++/4))) & 0x00FF0000)>>16);
-                       *(p_buffer+i) =
-                       (u8)((*(p_fw+(frame*128*8+(i/4))) & 0xFF000000)>>24);
+                       *(p_buffer + i) = (u8)(*(p_fw + (frame * 128 * 8 + (i / 4))) & 0x000000FF);
+                       i++;
+                       *(p_buffer + i) = (u8)((*(p_fw + (frame * 128 * 8 + (i / 4))) & 0x0000FF00) >> 8);
+                       i++;
+                       *(p_buffer + i) = (u8)((*(p_fw + (frame * 128 * 8 + (i / 4))) & 0x00FF0000) >> 16);
+                       i++;
+                       *(p_buffer + i) = (u8)((*(p_fw + (frame * 128 * 8 + (i / 4))) & 0xFF000000) >> 24);
                }
                cx231xx_ep5_bulkout(dev, p_buffer, _buffer_size);
        }