]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - probe_roms.c
get_info_super: report which other devices are thought to be working/failed.
[thirdparty/mdadm.git] / probe_roms.c
index a9a86388f394233fd36796e7713ea43ce8d71a2f..a8e3a5896f76f6a5d3fb85c9ffd6498e8b253ea3 100644 (file)
@@ -30,7 +30,7 @@
 
 static void *rom_mem = MAP_FAILED;
 static int rom_fd = -1;
-const static int rom_len = 0xf0000 - 0xc0000; /* option-rom memory region */
+static const int rom_len = 0xf0000 - 0xc0000; /* option-rom memory region */
 static int _sigbus;
 static unsigned long rom_align;
 
@@ -80,7 +80,7 @@ void probe_roms_exit(void)
 
 int probe_roms_init(unsigned long align)
 {
-       int fd;
+       int fd = -1;
        int rc = 0;
 
        /* valid values are 2048 and 512.  512 is for PCI-3.0 compliant
@@ -107,9 +107,11 @@ int probe_roms_init(unsigned long align)
 
        if (rc == 0)
                rom_fd = fd;
-       else
+       else {
+               if (fd >= 0) 
+                       close(fd);
                probe_roms_exit();
-
+       }
        return rc;
 }
 
@@ -197,7 +199,7 @@ static int romchecksum(const unsigned char *rom, unsigned long length)
 int scan_adapter_roms(scan_fn fn)
 {
        /* let scan_fn examing each of the adapter roms found by probe_roms */
-       int i;
+       unsigned int i;
        int found;
 
        if (rom_fd < 0)
@@ -229,7 +231,7 @@ void probe_roms(void)
        const void *rom;
        unsigned long start, length, upper;
        unsigned char c;
-       int i;
+       unsigned int i;
 
        if (rom_fd < 0)
                return;