Skip to content

Commit

Permalink
ptp_pch: fix error handling in pch_probe()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wei Yongjun authored and davem330 committed May 26, 2013
1 parent 4d2593c commit 0d8c3e7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/ptp/ptp_pch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 0d8c3e7

Please sign in to comment.