sony-laptop - fix using of uninitialized variable
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 10 Jan 2010 08:15:44 +0000 (00:15 -0800)
committerLen Brown <len.brown@intel.com>
Sat, 16 Jan 2010 20:55:43 +0000 (15:55 -0500)
CC [M]  drivers/platform/x86/sony-laptop.o
drivers/platform/x86/sony-laptop.c: In function 'sony_nc_rfkill_setup':
drivers/platform/x86/sony-laptop.c:1162: warning: 'i' may be used uninitialized in this function

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Acked-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/platform/x86/sony-laptop.c

index 5af53340da6f4736fb86c65c30fc296b2e5c97f7..3f71a605a49243e6a0ca121c5d5ec57e2a8e6757 100644 (file)
@@ -1201,9 +1201,12 @@ static void sony_nc_rfkill_setup(struct acpi_device *device)
        /* the buffer is filled with magic numbers describing the devices
         * available, 0xff terminates the enumeration
         */
-       while ((dev_code = *(device_enum->buffer.pointer + i)) != 0xff &&
-                       i < device_enum->buffer.length) {
-               i++;
+       for (i = 0; i < device_enum->buffer.length; i++) {
+
+               dev_code = *(device_enum->buffer.pointer + i);
+               if (dev_code == 0xff)
+                       break;
+
                dprintk("Radio devices, looking at 0x%.2x\n", dev_code);
 
                if (dev_code == 0 && !sony_rfkill_devices[SONY_WIFI])