[PATCH] parisc: wax: Use common error handling code in wax_init_chip()
From: Markus Elfring
Date: Wed Jun 10 2026 - 04:44:33 EST
From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxxxxxxx>
---
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