From: Markus Elfring <Markus.Elfring@web.de>
To: linux-parisc@vger.kernel.org, Helge Deller <deller@gmx.de>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] parisc: wax: Use common error handling code in wax_init_chip()
Date: Wed, 10 Jun 2026 10:40:32 +0200 [thread overview]
Message-ID: <d957773a-dad2-4c53-a93e-e189aa8605e9@web.de> (raw)
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
reply other threads:[~2026-06-10 8:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d957773a-dad2-4c53-a93e-e189aa8605e9@web.de \
--to=markus.elfring@web.de \
--cc=deller@gmx.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox