Skip to contentSkip to conversation

cmd: usb: check usb_stor_curr_dev in usb dev with no parameter

PATCH New Patrick Delaunay 2 participants 4 messages May 15, 2017 – Sep 12, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd: usb: check usb_stor_curr_dev in usb dev with no parameter

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

---

 cmd/usb.c | 4 ++++
 1 file changed, 4 insertions(+)
cmd/usb.c +4 -0
index 4fa456e..bc90553 100644
@@ -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);
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 cmd: usb: check usb_stor_curr_dev in usb dev with no parameter

Hi Marek,

Do think that this minor patch could be integrated in v2017.09 ?

http://patchwork.ozlabs.org/patch/762328/

Regards
Patrick

Quoted 40 lines

-----Original Message-----
From: Patrick DELAUNAY
Sent: lundi 15 mai 2017 11:16
To: u-boot at lists.denx.de
Cc: Yann GAUTIER <[email protected]>; Patrick DELAUNAY <[email protected]>; Michal Simek <[email protected]>; Simon Glass <[email protected]>; Peng Fan <[email protected]>; Hans de Goede <[email protected]>
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

---

 cmd/usb.c | 4 ++++
 1 file changed, 4 insertions(+)
cmd/usb.c +4 -0
index 4fa456e..bc90553 100644
@@ -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

#2 lore raw

PATCH 1/1 cmd: usb: check usb_stor_curr_dev in usb dev with no parameter

Quoted 1 line · Patrick DELAUNAY

Hi Marek,

Hi,

please stop top-posting.

Quoted 3 lines

Do think that this minor patch could be integrated in v2017.09 ?

http://patchwork.ozlabs.org/patch/762328/

Fix up the commit message, detail a bit more how to trigger the issue and use errno.h return value (-ENODEV ?) in the new code . Send V2 and I'll pick it.

Quoted 44 lines

Regards
Patrick

Quoted 40 lines

-----Original Message-----
From: Patrick DELAUNAY
Sent: lundi 15 mai 2017 11:16
To: u-boot at lists.denx.de
Cc: Yann GAUTIER <[email protected]>; Patrick DELAUNAY <[email protected]>; Michal Simek <[email protected]>; Simon Glass <[email protected]>; Peng Fan <[email protected]>; Hans de Goede <[email protected]>
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

---

 cmd/usb.c | 4 ++++
 1 file changed, 4 insertions(+)
cmd/usb.c +4 -0
index 4fa456e..bc90553 100644
@@ -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

Signature · 2 lines
Best regards,
Marek Vasut
#3 lore raw

PATCH 1/1 cmd: usb: check usb_stor_curr_dev in usb dev with no parameter

Hi Marek,

Quoted 8 lines · Patrick DELAUNAY
Quoted 1 line

Hi Marek,

Hi,

please stop top-posting.

Sorry, bad habit

Quoted 6 lines
Quoted 3 lines

Do think that this minor patch could be integrated in v2017.09 ?

http://patchwork.ozlabs.org/patch/762328/

Fix up the commit message, detail a bit more how to trigger the issue and use errno.h return value (-ENODEV ?) in the new code . Send V2 and I'll pick it.

Ok, I will send a V2 version today after a long delay due to holiday and other task.

For the result, I can't use errno.h because it is a command result, so I use CMD_RET_FAILURE is V2

Quoted 7 lines
Quoted 3 lines

Regards
Patrick

--
Best regards,
Marek Vasut

Best regards
Patrick