diff options
Diffstat (limited to 'nuttx/drivers/usbdev')
-rw-r--r-- | nuttx/drivers/usbdev/usbdev_scsi.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/nuttx/drivers/usbdev/usbdev_scsi.c b/nuttx/drivers/usbdev/usbdev_scsi.c index af535c0bc..6cc997d2f 100644 --- a/nuttx/drivers/usbdev/usbdev_scsi.c +++ b/nuttx/drivers/usbdev/usbdev_scsi.c @@ -1332,7 +1332,7 @@ static inline int usbstrg_cmdwrite12(FAR struct usbstrg_dev_s *priv) static int inline usbstrg_setupcmd(FAR struct usbstrg_dev_s *priv, ubyte cdblen, ubyte flags) { - FAR struct usbstrg_lun_s *lun; + FAR struct usbstrg_lun_s *lun = NULL; uint32 datlen; ubyte dir = flags & USBSTRG_FLAGS_DIRMASK; int ret = OK; @@ -1351,17 +1351,13 @@ static int inline usbstrg_setupcmd(FAR struct usbstrg_dev_s *priv, ubyte cdblen, lun = &priv->luntab[priv->cbwlun]; priv->lun = lun; } - else - { - priv->lun = NULL; - /* Only a few commands may specify unsupported LUNs */ + /* Only a few commands may specify unsupported LUNs */ - if ((flags & USBSTRG_FLAGS_LUNNOTNEEDED) == 0) - { - usbtrace(TRACE_CLSERROR(USBSTRG_TRACEERR_CMDBADLUN), priv->cbwlun); - ret = -EINVAL; - } + else if ((flags & USBSTRG_FLAGS_LUNNOTNEEDED) == 0) + { + usbtrace(TRACE_CLSERROR(USBSTRG_TRACEERR_CMDBADLUN), priv->cbwlun); + ret = -EINVAL; } /* Extract the direction and data transfer length */ |