netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ptp_pch: fix error handling in pch_probe()
@ 2013-05-23  9:59 Wei Yongjun
  2013-05-26  4:24 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2013-05-23  9:59 UTC (permalink / raw)
  To: richardcochran; +Cc: yongjun_wei, netdev

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

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>
---
 drivers/ptp/ptp_pch.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c
index bea9451..71a2559 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;
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ptp_pch: fix error handling in pch_probe()
  2013-05-23  9:59 [PATCH] ptp_pch: fix error handling in pch_probe() Wei Yongjun
@ 2013-05-26  4:24 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-05-26  4:24 UTC (permalink / raw)
  To: weiyj.lk; +Cc: richardcochran, yongjun_wei, netdev

From: Wei Yongjun <weiyj.lk@gmail.com>
Date: Thu, 23 May 2013 17:59:28 +0800

> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> 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>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-26  4:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-23  9:59 [PATCH] ptp_pch: fix error handling in pch_probe() Wei Yongjun
2013-05-26  4:24 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).