]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
super-intel: Make print_vmd_attached_devs() return int again
authorPawel Baldysiak <pawel.baldysiak@intel.com>
Fri, 11 Mar 2016 15:47:15 +0000 (16:47 +0100)
committerJes Sorensen <Jes.Sorensen@redhat.com>
Fri, 11 Mar 2016 17:33:46 +0000 (12:33 -0500)
This patch reverts a0abe1e
(super-intel: Make print_found_intel_controllers() return void)
and make this function "return int" again.
Also, interpreting the return value is added.

Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
super-intel.c

index 3fe304aad927f3e0077fd67bb9ebddd8f74c6bf4..8a80c5b02a7ed1130990f360fb7a36be12106ec7 100644 (file)
@@ -1766,7 +1766,7 @@ static int ahci_enumerate_ports(const char *hba_path, int port_count, int host_b
        return err;
 }
 
-static void print_vmd_attached_devs(struct sys_dev *hba)
+static int print_vmd_attached_devs(struct sys_dev *hba)
 {
        struct dirent *ent;
        DIR *dir;
@@ -1775,14 +1775,14 @@ static void print_vmd_attached_devs(struct sys_dev *hba)
        char *c, *rp;
 
        if (hba->type != SYS_DEV_VMD)
-               return;
+               return 1;
 
        /* scroll through /sys/dev/block looking for devices attached to
         * this hba
         */
        dir = opendir("/sys/bus/pci/drivers/nvme");
        if (!dir)
-               return;
+               return 1;
 
        for (ent = readdir(dir); ent; ent = readdir(dir)) {
                int n;
@@ -1818,6 +1818,7 @@ static void print_vmd_attached_devs(struct sys_dev *hba)
        }
 
        closedir(dir);
+       return 0;
 }
 
 static void print_found_intel_controllers(struct sys_dev *elem)
@@ -2024,7 +2025,11 @@ static int detail_platform_imsm(int verbose, int enumerate_only, char *controlle
                                        print_imsm_capability(&entry->orom);
                                        printf(" I/O Controller : %s (%s)\n",
                                                vmd_domain_to_controller(hba, buf), get_sys_dev_type(hba->type));
-                                       print_vmd_attached_devs(hba);
+                                       if (print_vmd_attached_devs(hba)) {
+                                               if (verbose > 0)
+                                                       pr_err("failed to get devices attached to VMD domain.\n");
+                                               result |= 2;
+                                       }
                                        printf("\n");
                                }
                        }