aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ptp
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2013-05-22 19:59:28 -0400
committerDavid S. Miller <davem@davemloft.net>2013-05-26 00:24:15 -0400
commit0d8c3e77e7fba8c84c871b43f35029daa92acc17 (patch)
tree4a7fa6d1716198258aeea3456917c9ac0444e14c /drivers/ptp
parent4d2593cc65fa15f2a36313aa8d03a0937226ad49 (diff)
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>
Diffstat (limited to 'drivers/ptp')
-rw-r--r--drivers/ptp/ptp_pch.c8
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)
628 628
629 chip->caps = ptp_pch_caps; 629 chip->caps = ptp_pch_caps;
630 chip->ptp_clock = ptp_clock_register(&chip->caps, &pdev->dev); 630 chip->ptp_clock = ptp_clock_register(&chip->caps, &pdev->dev);
631 631 if (IS_ERR(chip->ptp_clock)) {
632 if (IS_ERR(chip->ptp_clock)) 632 ret = PTR_ERR(chip->ptp_clock);
633 return PTR_ERR(chip->ptp_clock); 633 goto err_ptp_clock_reg;
634 }
634 635
635 spin_lock_init(&chip->register_lock); 636 spin_lock_init(&chip->register_lock);
636 637
@@ -669,6 +670,7 @@ pch_probe(struct pci_dev *pdev, const struct pci_device_id *id)
669 670
670err_req_irq: 671err_req_irq:
671 ptp_clock_unregister(chip->ptp_clock); 672 ptp_clock_unregister(chip->ptp_clock);
673err_ptp_clock_reg:
672 iounmap(chip->regs); 674 iounmap(chip->regs);
673 chip->regs = NULL; 675 chip->regs = NULL;
674 676