* [PATCH 9/9] staging: dgap: introduce dgap_release_remap()
@ 2014-06-13 7:44 Daeseok Youn
2014-06-13 8:33 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Daeseok Youn @ 2014-06-13 7:44 UTC (permalink / raw)
To: lidza.louina, gregkh
Cc: markh, dan.carpenter, driverdev-devel, devel, linux-kernel
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@gmail.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 9/9] staging: dgap: introduce dgap_release_remap()
2014-06-13 7:44 [PATCH 9/9] staging: dgap: introduce dgap_release_remap() Daeseok Youn
@ 2014-06-13 8:33 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2014-06-13 8:33 UTC (permalink / raw)
To: Daeseok Youn
Cc: lidza.louina, gregkh, markh, driverdev-devel, devel, linux-kernel
On Fri, Jun 13, 2014 at 04:44:11PM +0900, Daeseok Youn wrote:
> 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.
>
Oh... Here you clean up the rest that I mentioned in reviewing 8/9.
Fine fine.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-13 8:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-13 7:44 [PATCH 9/9] staging: dgap: introduce dgap_release_remap() Daeseok Youn
2014-06-13 8:33 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).