staging: dgap: introduce dgap_release_remap()
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 <[email protected]>
--- drivers/staging/dgap/dgap.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-)
drivers/staging/dgap/dgap.c +11 -3
@@ -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:
Signature · 1 line
1.7.1
Quoted 5 lines · Daeseok Youn
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 afterdgap_found_board()indgap_init_one()is failed.
Oh... Here you clean up the rest that I mentioned in reviewing 8/9.
Fine fine.
regards,
dan carpenter