From: Patrick DELAUNAY Date: Thu, 3 Aug 2017 13:25:30 +0000 Subject: [U-Boot] [PATCH] cmd: usb: check usb_stor_curr_dev in usb dev with no parameter In-Reply-To: <1494839745-20351-1-git-send-email-patrick.delaunay@st.com> References: <1494839745-20351-1-git-send-email-patrick.delaunay@st.com> Message-ID: <9ecbcdf1d8de4cde8f5bebbdf76c5420@SFHDAG6NODE3.st.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Marek, Do think that this minor patch could be integrated in v2017.09 ? http://patchwork.ozlabs.org/patch/762328/ Regards Patrick > -----Original Message----- > From: Patrick DELAUNAY > Sent: lundi 15 mai 2017 11:16 > To: u-boot at lists.denx.de > Cc: Yann GAUTIER ; Patrick DELAUNAY > ; Michal Simek ; > Simon Glass ; Peng Fan ; > Hans de Goede > Subject: [PATCH] cmd: usb: check usb_stor_curr_dev in usb dev with no > parameter > Importance: High > > If 'usb start' does not find devices, the command 'usb dev' > without parameter will lead to error= USB device -1: data abort A check on > usb_stor_curr_dev avoid the issue > > Signed-off-by: Patrick Delaunay > --- > > cmd/usb.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/cmd/usb.c b/cmd/usb.c > index 4fa456e..bc90553 100644 > --- a/cmd/usb.c > +++ b/cmd/usb.c > @@ -803,6 +803,10 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, > char * const argv[]) > printf("... is now current device\n"); > return 0; > } else { > + if (usb_stor_curr_dev < 0) { > + printf("no current device selected\n"); > + return 1; > + } > printf("\nUSB device %d: ", usb_stor_curr_dev); > stor_dev = blk_get_devnum_by_type(IF_TYPE_USB, > usb_stor_curr_dev); > -- > 1.9.1