summaryrefslogtreecommitdiff
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorSuwan Kim <suwan.kim027@gmail.com>2019-01-30 23:48:28 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-04 12:58:03 +0100
commit1760435d613c9ee536eaf40ffa97958c3e1973fe (patch)
treea96e865e8736eccc3dd101d7bd54a34822376abb /drivers/usb/core
parenta2fd23b93733bf604870eb8a15ccaa74c9b23889 (diff)
usb: core: Move variable initialization to appropriate place
It is better to initialize the variable 'cfgno' in the for loop than at the current place. Signed-off-by: Suwan Kim <suwan.kim027@gmail.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/config.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index 4a0945c04b4c..7bb6b1bd06c8 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -805,7 +805,6 @@ int usb_get_configuration(struct usb_device *dev)
unsigned char *bigbuffer;
struct usb_config_descriptor *desc;
- cfgno = 0;
if (ncfg > USB_MAXCONFIG) {
dev_warn(ddev, "too many configurations: %d, "
"using maximum allowed: %d\n", ncfg, USB_MAXCONFIG);
@@ -831,7 +830,7 @@ int usb_get_configuration(struct usb_device *dev)
if (!desc)
goto err2;
- for (; cfgno < ncfg; cfgno++) {
+ for (cfgno = 0; cfgno < ncfg; cfgno++) {
/* We grab just the first descriptor so we know how long
* the whole configuration is */
result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno,