[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54BD4F10.9040401@users.sourceforge.net>
Date: Mon, 19 Jan 2015 19:38:08 +0100
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: Jean-Christophe Plagniol-Villard <plagnioj@...osoft.com>,
Tomi Valkeinen <tomi.valkeinen@...com>,
linux-fbdev@...r.kernel.org
CC: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH 5/9] video: Less function calls in trident_pci_probe() after
error detection
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Mon, 19 Jan 2015 14:18:47 +0100
The functions "iounmap" and "kfree" could be called in a few cases by the
trident_pci_probe() function during error handling even if the passed data
structure element contained still a null pointer.
This implementation detail could be improved by adjustments for jump labels.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/video/fbdev/tridentfb.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/video/fbdev/tridentfb.c b/drivers/video/fbdev/tridentfb.c
index 71567401..86d4733 100644
--- a/drivers/video/fbdev/tridentfb.c
+++ b/drivers/video/fbdev/tridentfb.c
@@ -1436,7 +1436,7 @@ static int trident_pci_probe(struct pci_dev *dev,
if (!default_par->io_virt) {
debug("ioremap failed\n");
err = -1;
- goto out_unmap1;
+ goto release_memory_region_mmio;
}
enable_mmio(default_par);
@@ -1459,7 +1459,7 @@ static int trident_pci_probe(struct pci_dev *dev,
if (!info->screen_base) {
debug("ioremap failed\n");
err = -1;
- goto out_unmap2;
+ goto release_memory_region_smem;
}
default_par->flatpanel = is_flatpanel(default_par);
@@ -1485,7 +1485,7 @@ static int trident_pci_probe(struct pci_dev *dev,
info->pixmap.addr = kmalloc(4096, GFP_KERNEL);
if (!info->pixmap.addr) {
err = -ENOMEM;
- goto out_unmap2;
+ goto io_unmap_screenbase;
}
info->pixmap.size = 4096;
@@ -1531,11 +1531,14 @@ static int trident_pci_probe(struct pci_dev *dev,
out_unmap2:
kfree(info->pixmap.addr);
+io_unmap_screenbase:
iounmap(info->screen_base);
+release_memory_region_smem:
release_mem_region(tridentfb_fix.smem_start, tridentfb_fix.smem_len);
disable_mmio(info->par);
out_unmap1:
iounmap(default_par->io_virt);
+release_memory_region_mmio:
release_mem_region(tridentfb_fix.mmio_start, tridentfb_fix.mmio_len);
framebuffer_release(info);
return err;
--
2.2.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists