[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140613074411.GA31639@devel.8.8.4.4>
Date: Fri, 13 Jun 2014 16:44:11 +0900
From: Daeseok Youn <daeseok.youn@...il.com>
To: lidza.louina@...il.com, gregkh@...uxfoundation.org
Cc: markh@...pro.net, dan.carpenter@...cle.com,
driverdev-devel@...uxdriverproject.org, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 9/9] staging: dgap: introduce dgap_release_remap()
The dgap_found_board() did request some memory region and
call ioremap, these should be released and unmaped
when one of functions which are called after dgap_found_board()
in dgap_init_one() is failed.
Signed-off-by: Daeseok Youn <daeseok.youn@...il.com>
---
drivers/staging/dgap/dgap.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index e1347fb..5c8e622 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -77,6 +77,7 @@ static int dgap_init_pci(void);
static int dgap_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
static void dgap_remove_one(struct pci_dev *dev);
static int dgap_do_remap(struct board_t *brd);
+static void dgap_release_remap(struct board_t *brd);
static irqreturn_t dgap_intr(int irq, void *voidbrd);
static int dgap_tty_open(struct tty_struct *tty, struct file *file);
@@ -588,11 +589,11 @@ static int dgap_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
brd = dgap_board[dgap_numboards++];
rc = dgap_firmware_load(pdev, ent->driver_data, brd);
if (rc)
- goto free_brd;
+ goto cleanup_brd;
rc = dgap_alloc_flipbuf(brd);
if (rc)
- goto free_brd;
+ goto cleanup_brd;
rc = dgap_tty_register(brd);
if (rc)
@@ -626,7 +627,8 @@ unregister_tty:
dgap_tty_unregister(brd);
free_flipbuf:
dgap_free_flipbuf(brd);
-free_brd:
+cleanup_brd:
+ dgap_release_remap(brd);
kfree(brd);
dgap_board[--dgap_numboards] = NULL;
return rc;
@@ -1034,6 +1036,12 @@ static int dgap_do_remap(struct board_t *brd)
return 0;
}
+static void dgap_release_remap(struct board_t *brd)
+{
+ release_mem_region(brd->membase, 0x200000);
+ release_mem_region(brd->membase + PCI_IO_OFFSET, 0x200000);
+ iounmap(brd->re_map_membase);
+}
/*****************************************************************************
*
* Function:
--
1.7.1
--
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