]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mvsas: always iounmap resources
authorJohannes Thumshirn <jthumshirn@suse.de>
Fri, 22 May 2015 09:15:02 +0000 (11:15 +0200)
committerJames Bottomley <JBottomley@Odin.com>
Wed, 12 Aug 2015 18:18:47 +0000 (11:18 -0700)
In case pci_resource_start() or pci_resource_len() reutrn 0, mvsas_ioremap
returns without doing an iounmap() of mvi->regs_ex.

Found by the cocinelle tool.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
drivers/scsi/mvsas/mv_init.c

index d40d734aa53a522e2e115d70e24f6d50804238c7..f466a6aa8830c9d2341a21c92e3d1904a7521bd5 100644 (file)
@@ -338,8 +338,11 @@ int mvs_ioremap(struct mvs_info *mvi, int bar, int bar_ex)
 
        res_start = pci_resource_start(pdev, bar);
        res_len = pci_resource_len(pdev, bar);
-       if (!res_start || !res_len)
+       if (!res_start || !res_len) {
+               iounmap(mvi->regs_ex);
+               mvi->regs_ex = NULL;
                goto err_out;
+       }
 
        res_flag = pci_resource_flags(pdev, bar);
        if (res_flag & IORESOURCE_CACHEABLE)