提交 45257fa9 编写于 作者: J Jiri Slaby 提交者: Linus Torvalds

[PATCH] Char: mxser_new, fix twice resource releasing

Because brd->info is not NULLed, resources are released twice.  NULL it in
pci_remove function.  Also take care of retval and releasing in pci_probe --
mxser_initbrd alreasy releases resource, do not do it again in fail path in
probe function.

Cc: Sergei Organov <osv@javad.com>
Signed-off-by: NJiri Slaby <jirislaby@gmail.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 18b95576
...@@ -2403,9 +2403,8 @@ static int __devinit mxser_initbrd(struct mxser_board *brd, ...@@ -2403,9 +2403,8 @@ static int __devinit mxser_initbrd(struct mxser_board *brd,
brd->info->name, brd->irq); brd->info->name, brd->irq);
/* We hold resources, we need to release them. */ /* We hold resources, we need to release them. */
mxser_release_res(brd, pdev, 0); mxser_release_res(brd, pdev, 0);
return retval;
} }
return 0; return retval;
} }
static int __init mxser_get_ISA_conf(int cap, struct mxser_board *brd) static int __init mxser_get_ISA_conf(int cap, struct mxser_board *brd)
...@@ -2590,8 +2589,9 @@ static int __devinit mxser_probe(struct pci_dev *pdev, ...@@ -2590,8 +2589,9 @@ static int __devinit mxser_probe(struct pci_dev *pdev,
} }
/* mxser_initbrd will hook ISR. */ /* mxser_initbrd will hook ISR. */
if (mxser_initbrd(brd, pdev) < 0) retval = mxser_initbrd(brd, pdev);
goto err_relvec; if (retval)
goto err_null;
for (i = 0; i < brd->info->nports; i++) for (i = 0; i < brd->info->nports; i++)
tty_register_device(mxvar_sdriver, brd->idx + i, &pdev->dev); tty_register_device(mxvar_sdriver, brd->idx + i, &pdev->dev);
...@@ -2599,10 +2599,9 @@ static int __devinit mxser_probe(struct pci_dev *pdev, ...@@ -2599,10 +2599,9 @@ static int __devinit mxser_probe(struct pci_dev *pdev,
pci_set_drvdata(pdev, brd); pci_set_drvdata(pdev, brd);
return 0; return 0;
err_relvec:
pci_release_region(pdev, 3);
err_relio: err_relio:
pci_release_region(pdev, 2); pci_release_region(pdev, 2);
err_null:
brd->info = NULL; brd->info = NULL;
err: err:
return retval; return retval;
...@@ -2620,6 +2619,7 @@ static void __devexit mxser_remove(struct pci_dev *pdev) ...@@ -2620,6 +2619,7 @@ static void __devexit mxser_remove(struct pci_dev *pdev)
tty_unregister_device(mxvar_sdriver, brd->idx + i); tty_unregister_device(mxvar_sdriver, brd->idx + i);
mxser_release_res(brd, pdev, 1); mxser_release_res(brd, pdev, 1);
brd->info = NULL;
} }
static struct pci_driver mxser_driver = { static struct pci_driver mxser_driver = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册