From: Antonio Ospite Date: Tue, 5 Jan 2016 19:08:18 +0000 (+0100) Subject: kinect_upload_fw: initialize current_configuration before libusb_get_configuration() X-Git-Tag: v0.4~12 X-Git-Url: https://git.ao2.it/kinect-audio-setup.git/commitdiff_plain/5ce56f2a88df03c9560eef61c7d6532cd48ff5d9?ds=inline kinect_upload_fw: initialize current_configuration before libusb_get_configuration() Initialize the variable as suggested by http://libusb.sourceforge.net/api-1.0/caveats.html --- diff --git a/kinect_upload_fw/kinect_upload_fw.c b/kinect_upload_fw/kinect_upload_fw.c index e3b72db..f145865 100644 --- a/kinect_upload_fw/kinect_upload_fw.c +++ b/kinect_upload_fw/kinect_upload_fw.c @@ -155,13 +155,14 @@ int main(int argc, char** argv) { goto fail_libusb_open; } - int current_configuration = 0; + int current_configuration = -1; libusb_get_configuration(dev, ¤t_configuration); if (current_configuration != 1) libusb_set_configuration(dev, 1); libusb_claim_interface(dev, 0); + current_configuration = -1; libusb_get_configuration(dev, ¤t_configuration); if (current_configuration != 1) { res = -ENODEV;