]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
scsi: Change scsi_scan() to be able to return value
authorMichal Simek <michal.simek@xilinx.com>
Wed, 30 Nov 2016 11:12:31 +0000 (12:12 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Fri, 2 Dec 2016 13:37:26 +0000 (14:37 +0100)
With DM_SCSI this function will return more than one return value to
cover errors.

Suggested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
cmd/scsi.c
common/scsi.c
include/scsi.h

index 387ca1a262ab505c9e680c8874111a91bcf4bc5d..7442e6aef4d9d06a2efcb0eb55ed5d4a416a0db3 100644 (file)
@@ -27,6 +27,8 @@ int do_scsiboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
  */
 int do_scsi(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
+       int ret;
+
        switch (argc) {
        case 0:
        case 1:
@@ -35,8 +37,10 @@ int do_scsi(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
                if (strncmp(argv[1], "res", 3) == 0) {
                        printf("\nReset SCSI\n");
                        scsi_bus_reset();
-                       scsi_scan(1);
-                       return 0;
+                       ret = scsi_scan(1);
+                       if (ret)
+                               return CMD_RET_FAILURE;
+                       return ret;
                }
                if (strncmp(argv[1], "inf", 3) == 0) {
                        blk_list_devices(IF_TYPE_SCSI);
@@ -51,8 +55,10 @@ int do_scsi(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
                        return 0;
                }
                if (strncmp(argv[1], "scan", 4) == 0) {
-                       scsi_scan(1);
-                       return 0;
+                       ret = scsi_scan(1);
+                       if (ret)
+                               return CMD_RET_FAILURE;
+                       return ret;
                }
                if (strncmp(argv[1], "part", 4) == 0) {
                        if (blk_list_part(IF_TYPE_SCSI))
index ba656160581002261d34bd96c2840e8da6eb57ea..839b30b9bb8ee57e592be8b6f2e6ddcc153ec436 100644 (file)
@@ -524,7 +524,7 @@ removable:
  * (re)-scan the scsi bus and reports scsi device info
  * to the user if mode = 1
  */
-void scsi_scan(int mode)
+int scsi_scan(int mode)
 {
        unsigned char i, lun;
        int ret;
@@ -558,6 +558,7 @@ void scsi_scan(int mode)
 #ifndef CONFIG_SPL_BUILD
        setenv_ulong("scsidevs", scsi_max_devs);
 #endif
+       return 0;
 }
 
 #ifdef CONFIG_BLK
index eed8ff971731b7cf67199e6f0e59a34bdc24b261..c8796785a465e82b55a1d2864722d2c14ee55f89 100644 (file)
@@ -173,7 +173,7 @@ void scsi_low_level_init(int busdevfunc);
  * functions residing inside cmd_scsi.c
  */
 void scsi_init(void);
-void scsi_scan(int mode);
+int scsi_scan(int mode);
 
 #define SCSI_IDENTIFY                                  0xC0  /* not used */