mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ptp_pch: release chip->mem_base and chip->regs on error
@ 2012-10-18  9:48 Yuanhan Liu
  2012-10-19  6:26 ` Richard Cochran
  0 siblings, 1 reply; 2+ messages in thread
From: Yuanhan Liu @ 2012-10-18  9:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: fengguang.wu, Yuanhan Liu, Richard Cochran, David S. Miller

Fix smatch warnings catched by Fengguang's 0-DAY system:
+ drivers/ptp/ptp_pch.c:641 pch_probe() warn: 'chip->mem_base' was not released on error
+ drivers/ptp/ptp_pch.c:641 pch_probe() warn: 'chip->regs' was not released on error

Cc: Richard Cochran <richardcochran@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 drivers/ptp/ptp_pch.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c
index e624e4d..daddd88 100644
--- a/drivers/ptp/ptp_pch.c
+++ b/drivers/ptp/ptp_pch.c
@@ -629,8 +629,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;
+	}
 
 	spin_lock_init(&chip->register_lock);
 
@@ -669,6 +671,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:
 	iounmap(chip->regs);
 	chip->regs = 0;
 
-- 
1.7.7.6


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

end of thread, other threads:[~2012-10-19  6:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-18  9:48 [PATCH] ptp_pch: release chip->mem_base and chip->regs on error Yuanhan Liu
2012-10-19  6:26 ` Richard Cochran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®