]> git.karo-electronics.de Git - linux-beck.git/commitdiff
usb: gadget: Remove the LUN checks which are always true
authorMaxin B John <maxin.john@gmail.com>
Sun, 8 May 2011 12:56:17 +0000 (15:56 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 10 May 2011 21:14:59 +0000 (14:14 -0700)
Comparing an unsigned integer with greater than or equal to zero is
always true.  So, it is safe to remove similar checks from
'f_mass_storage.c' and 'file_storage.c'

Signed-off-by: Maxin B. John <maxin.john@gmail.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/f_mass_storage.c
drivers/usb/gadget/file_storage.c

index ad96be808b29d8bf17e1ae89a63bae4f2ce71b9f..efb58f9f5aa90db0fc933301ca10e7008a1295cb 100644 (file)
@@ -1884,7 +1884,7 @@ static int check_command(struct fsg_common *common, int cmnd_size,
                    common->lun, lun);
 
        /* Check the LUN */
-       if (common->lun >= 0 && common->lun < common->nluns) {
+       if (common->lun < common->nluns) {
                curlun = &common->luns[common->lun];
                common->curlun = curlun;
                if (common->cmnd[0] != REQUEST_SENSE) {
index fcfc77c7ad7008655e7275080780ea1d118f46eb..0360f56221ea21ed3eda1fc93cfde2ecd76bc08c 100644 (file)
@@ -2285,7 +2285,7 @@ static int check_command(struct fsg_dev *fsg, int cmnd_size,
                fsg->lun = lun;         // Use LUN from the command
 
        /* Check the LUN */
-       if (fsg->lun >= 0 && fsg->lun < fsg->nluns) {
+       if (fsg->lun < fsg->nluns) {
                fsg->curlun = curlun = &fsg->luns[fsg->lun];
                if (fsg->cmnd[0] != REQUEST_SENSE) {
                        curlun->sense_data = SS_NO_SENSE;