Re: [PATCH] hciemu: Always initialize status in hci_host_control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Szymon,

> Assign 0x00 to status on intialization instead of assigning it in each
> switch case. This helps to avoid errors when one forget to proper
> intialize status in new case.
> 
> This fix following compilation error:
> 
>   CC     test/hciemu.o
> cc1: warnings being treated as errors
> test/hciemu.c: In function ‘hci_host_control’:
> test/hciemu.c:786: error: ‘status’ may be used uninitialized in this function
> make[1]: *** [test/hciemu.o] Error 1

actually gcc warns here rightfully, but the fix is actually a different
one:

@@ -783,7 +783,7 @@ static void hci_host_control(uint16_t ocf, int plen, uint8_t
                break;
 
        default:
-               command_status(ogf, ocf, status);
+               command_status(ogf, ocf, 0x01);
                break;
        }

Pushed that one upstream.

I am always suspicious if the fix to a compiler warning like this is
just to initialize the variable. We prefer not to do that since then it
starts hiding real bugs. This is a good example.

Regards

Marcel


--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux