[PATCH] drivers/edac/i3200_edac.c: add missing iounmap

From: Julia Lawall
Date: Mon Apr 30 2012 - 01:59:06 EST


From: Julia Lawall <Julia.Lawall@xxxxxxx>

Add iounmap in the case where window has already been allocated.
Reorganize the error handling code at the end of the function so that if is
not needed.

Signed-off-by: Julia Lawall <Julia.Lawall@xxxxxxx>

---
drivers/edac/i3200_edac.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/edac/i3200_edac.c b/drivers/edac/i3200_edac.c
index 046808c..55c4336 100644
--- a/drivers/edac/i3200_edac.c
+++ b/drivers/edac/i3200_edac.c
@@ -338,8 +338,10 @@ static int i3200_probe1(struct pci_dev *pdev, int dev_idx)

mci = edac_mc_alloc(sizeof(struct i3200_priv), I3200_RANKS,
nr_channels, 0);
- if (!mci)
- return -ENOMEM;
+ if (!mci) {
+ rc = -ENOMEM;
+ goto fail_alloc;
+ }

debugf3("MC: %s(): init mci\n", __func__);

@@ -404,9 +406,9 @@ static int i3200_probe1(struct pci_dev *pdev, int dev_idx)
return 0;

fail:
+ edac_mc_free(mci);
+fail_alloc:
iounmap(window);
- if (mci)
- edac_mc_free(mci);

return rc;
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/