]> git.karo-electronics.de Git - linux-beck.git/commitdiff
scsi: g_NCR5380: Fix release_region in error handling
authorOndrej Zary <linux@rainbow-software.org>
Thu, 10 Nov 2016 23:00:20 +0000 (10:00 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2017 10:39:29 +0000 (11:39 +0100)
commit 7b93ca43b7e21fbe6fb1a6f4ecce4a2f70f424a0 upstream.

When a SW-configurable card is specified but not found, the driver
releases wrong region, causing the following message in kernel log:
Trying to free nonexistent resource <0000000000000000-000000000000000f>

Fix it by assigning base earlier.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Fixes: a8cfbcaec0c1 ("scsi: g_NCR5380: Stop using scsi_module.c")
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/g_NCR5380.c

index cbf010324c187589e199f2b14ef3793bf892f2a9..596a75924d90210b092d93904c54521d1e903279 100644 (file)
@@ -170,12 +170,12 @@ static int generic_NCR5380_init_one(struct scsi_host_template *tpnt,
                if (ports[i]) {
                        /* At this point we have our region reserved */
                        magic_configure(i, 0, magic); /* no IRQ yet */
-                       outb(0xc0, ports[i] + 9);
-                       if (inb(ports[i] + 9) != 0x80) {
+                       base = ports[i];
+                       outb(0xc0, base + 9);
+                       if (inb(base + 9) != 0x80) {
                                ret = -ENODEV;
                                goto out_release;
                        }
-                       base = ports[i];
                        port_idx = i;
                } else
                        return -EINVAL;