diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2013-05-23 01:59:28 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-05-26 06:24:15 +0200 |
commit | 0d8c3e77e7fba8c84c871b43f35029daa92acc17 (patch) | |
tree | 4a7fa6d1716198258aeea3456917c9ac0444e14c | |
parent | qlge: add missing free_netdev() on error in qlge_probe() (diff) | |
download | linux-0d8c3e77e7fba8c84c871b43f35029daa92acc17.tar.xz linux-0d8c3e77e7fba8c84c871b43f35029daa92acc17.zip |
ptp_pch: fix error handling in pch_probe()
Fix to release resources when ptp_clock_register() fail instead
of return error code directly.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/ptp/ptp_pch.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c index bea94510ad2d..71a2559278d7 100644 --- a/drivers/ptp/ptp_pch.c +++ b/drivers/ptp/ptp_pch.c @@ -628,9 +628,10 @@ pch_probe(struct pci_dev *pdev, const struct pci_device_id *id) chip->caps = ptp_pch_caps; chip->ptp_clock = ptp_clock_register(&chip->caps, &pdev->dev); - - if (IS_ERR(chip->ptp_clock)) - return PTR_ERR(chip->ptp_clock); + if (IS_ERR(chip->ptp_clock)) { + ret = PTR_ERR(chip->ptp_clock); + goto err_ptp_clock_reg; + } spin_lock_init(&chip->register_lock); @@ -669,6 +670,7 @@ pch_probe(struct pci_dev *pdev, const struct pci_device_id *id) err_req_irq: ptp_clock_unregister(chip->ptp_clock); +err_ptp_clock_reg: iounmap(chip->regs); chip->regs = NULL; |