aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-12-03 09:32:36 -0500
committerFelipe Balbi <balbi@ti.com>2013-01-10 05:36:47 -0500
commit98f3a1b90795d7216de0d56157868d174317f91a (patch)
treefa97d798f6f13ad9d818a0bebf69575f8fbaac4d /drivers/usb
parentb642435333b23ab01d526bd854d118704434fc88 (diff)
usb: gadget: mass_storage: remove >= 0 check for unsigned type
| In file included from drivers/usb/gadget/acm_ms.c:43: | f_mass_storage.c:2199:18: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare] | if (common->lun >= 0 && common->lun < common->nluns) | ~~~~~~~~~~~ ^ ~ common->lun is defined as "unsigned int" so its value is always >= 0. It is assigned via cbw->Lun which is defined as u8 so it is also not abused as -1. [ mina86@mina86.com : make lun unsigned int and use %u in DBG() macro for it ] Signed-off-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/f_mass_storage.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 4ce732852ae8..fc5c16ca5e0a 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -1691,7 +1691,7 @@ static int check_command(struct fsg_common *common, int cmnd_size,
1691 int needs_medium, const char *name) 1691 int needs_medium, const char *name)
1692{ 1692{
1693 int i; 1693 int i;
1694 int lun = common->cmnd[1] >> 5; 1694 unsigned int lun = common->cmnd[1] >> 5;
1695 static const char dirletter[4] = {'u', 'o', 'i', 'n'}; 1695 static const char dirletter[4] = {'u', 'o', 'i', 'n'};
1696 char hdlen[20]; 1696 char hdlen[20];
1697 struct fsg_lun *curlun; 1697 struct fsg_lun *curlun;
@@ -1757,7 +1757,7 @@ static int check_command(struct fsg_common *common, int cmnd_size,
1757 1757
1758 /* Check that the LUN values are consistent */ 1758 /* Check that the LUN values are consistent */
1759 if (common->lun != lun) 1759 if (common->lun != lun)
1760 DBG(common, "using LUN %d from CBW, not LUN %d from CDB\n", 1760 DBG(common, "using LUN %u from CBW, not LUN %u from CDB\n",
1761 common->lun, lun); 1761 common->lun, lun);
1762 1762
1763 /* Check the LUN */ 1763 /* Check the LUN */
@@ -1777,7 +1777,7 @@ static int check_command(struct fsg_common *common, int cmnd_size,
1777 */ 1777 */
1778 if (common->cmnd[0] != INQUIRY && 1778 if (common->cmnd[0] != INQUIRY &&
1779 common->cmnd[0] != REQUEST_SENSE) { 1779 common->cmnd[0] != REQUEST_SENSE) {
1780 DBG(common, "unsupported LUN %d\n", common->lun); 1780 DBG(common, "unsupported LUN %u\n", common->lun);
1781 return -EINVAL; 1781 return -EINVAL;
1782 } 1782 }
1783 } 1783 }
@@ -2169,7 +2169,7 @@ static int received_cbw(struct fsg_dev *fsg, struct fsg_buffhd *bh)
2169 if (common->data_size == 0) 2169 if (common->data_size == 0)
2170 common->data_dir = DATA_DIR_NONE; 2170 common->data_dir = DATA_DIR_NONE;
2171 common->lun = cbw->Lun; 2171 common->lun = cbw->Lun;
2172 if (common->lun >= 0 && common->lun < common->nluns) 2172 if (common->lun < common->nluns)
2173 common->curlun = &common->luns[common->lun]; 2173 common->curlun = &common->luns[common->lun];
2174 else 2174 else
2175 common->curlun = NULL; 2175 common->curlun = NULL;