mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] parisc: wax: Use common error handling code in wax_init_chip()
@ 2026-06-10  8:40 Markus Elfring
  0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2026-06-10  8:40 UTC (permalink / raw)
  To: linux-parisc, Helge Deller; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 10 Jun 2026 10:36:06 +0200

Use an additional label so that a bit of exception handling can be better
reused at the end of this function implementation.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/parisc/wax.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/parisc/wax.c b/drivers/parisc/wax.c
index a82a5e88ed6d..5146b37b7016 100644
--- a/drivers/parisc/wax.c
+++ b/drivers/parisc/wax.c
@@ -88,27 +88,23 @@ static int __init wax_init_chip(struct parisc_device *dev)
 	if (dev->irq < 0) {
 		printk(KERN_ERR "%s(): cannot get GSC irq\n",
 				__func__);
-		kfree(wax);
-		return -EBUSY;
+		ret = -EBUSY;
+		goto free_wax;
 	}
 
 	wax->eim = ((u32) wax->gsc_irq.txn_addr) | wax->gsc_irq.txn_data;
 
 	ret = request_irq(wax->gsc_irq.irq, gsc_asic_intr, 0, "wax", wax);
-	if (ret < 0) {
-		kfree(wax);
-		return ret;
-	}
+	if (ret < 0)
+		goto free_wax;
 
 	/* enable IRQ's for devices below WAX */
 	gsc_writel(wax->eim, wax->hpa + OFFSET_IAR);
 
 	/* Done init'ing, register this driver */
 	ret = gsc_common_setup(dev, wax);
-	if (ret) {
-		kfree(wax);
-		return ret;
-	}
+	if (ret)
+		goto free_wax;
 
 	gsc_fixup_irqs(dev, wax, wax_choose_irq);
 	/* On 715-class machines, Wax EISA is a sibling of Wax, not a child. */
@@ -118,6 +114,10 @@ static int __init wax_init_chip(struct parisc_device *dev)
 	}
 
 	return ret;
+
+free_wax:
+	kfree(wax);
+	return ret;
 }
 
 static const struct parisc_device_id wax_tbl[] __initconst = {
-- 
2.54.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-10  8:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-10  8:40 [PATCH] parisc: wax: Use common error handling code in wax_init_chip() Markus Elfring

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

Powered by JetHome