[PATCH 1/2] usb: class: move "checking 'actual'" code block into "checking 'buffer[1]'" code block

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

 



The variable 'actual' is only used in "checking 'buffer[1]'" code
block, so need move it into, or it may not be initialized.

Signed-off-by: Chen Gang <gang.chen@xxxxxxxxxxx>
---
 drivers/usb/class/usbtmc.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 609dbc2..42d62c9 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -786,7 +786,7 @@ usbtmc_clear_check_status:
 		goto exit;
 	}
 
-	if (buffer[1] == 1)
+	if (buffer[1] == 1) {
 		do {
 			dev_dbg(dev, "Reading from bulk in EP\n");
 
@@ -805,11 +805,13 @@ usbtmc_clear_check_status:
 		} while ((actual == max_size) &&
 			  (n < USBTMC_MAX_READS_TO_CLEAR_BULK_IN));
 
-	if (actual == max_size) {
-		dev_err(dev, "Couldn't clear device buffer within %d cycles\n",
-			USBTMC_MAX_READS_TO_CLEAR_BULK_IN);
-		rv = -EPERM;
-		goto exit;
+		if (actual == max_size) {
+			dev_err(dev,
+				"Couldn't clear device buffer within %d cycles\n",
+				USBTMC_MAX_READS_TO_CLEAR_BULK_IN);
+			rv = -EPERM;
+			goto exit;
+		}
 	}
 
 	goto usbtmc_clear_check_status;
-- 
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux