From 5ce56f2a88df03c9560eef61c7d6532cd48ff5d9 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Tue, 5 Jan 2016 20:08:18 +0100 Subject: [PATCH] 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 --- kinect_upload_fw/kinect_upload_fw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 2.1.4