From: Markus Elfring <Markus.Elfring@web.de>
To: arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Cristian Marussi <cristian.marussi@arm.com>,
Sudeep Holla <sudeep.holla@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] firmware: arm_scmi: Use common error handling code in __scmi_device_create()
Date: Thu, 11 Jun 2026 10:34:52 +0200 [thread overview]
Message-ID: <545ffb86-55f5-46b2-83ca-285cd8d540d7@web.de> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 11 Jun 2026 10:27:45 +0200
Use an additional label so that a bit of exception handling can be better
reused at the end of an if branch.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/firmware/arm_scmi/bus.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c
index 793be9eabaed..8c20ed1a8243 100644
--- a/drivers/firmware/arm_scmi/bus.c
+++ b/drivers/firmware/arm_scmi/bus.c
@@ -450,14 +450,13 @@ __scmi_device_create(struct device_node *np, struct device *parent,
return NULL;
scmi_dev->name = kstrdup_const(name ?: "unknown", GFP_KERNEL);
- if (!scmi_dev->name) {
- kfree(scmi_dev);
- return NULL;
- }
+ if (!scmi_dev->name)
+ goto free_scmi_dev;
id = ida_alloc_min(&scmi_bus_id, 1, GFP_KERNEL);
if (id < 0) {
kfree_const(scmi_dev->name);
+free_scmi_dev:
kfree(scmi_dev);
return NULL;
}
--
2.54.0
next reply other threads:[~2026-06-11 8:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 8:34 Markus Elfring [this message]
2026-06-11 11:20 ` [PATCH] firmware: arm_scmi: Use common error handling code in __scmi_device_create() Cristian Marussi
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=545ffb86-55f5-46b2-83ca-285cd8d540d7@web.de \
--to=markus.elfring@web.de \
--cc=arm-scmi@vger.kernel.org \
--cc=cristian.marussi@arm.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sudeep.holla@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.