From: Nam Cao <namcao@linutronix.de>
To: Marc Zyngier <maz@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Antoine Tenart <atenart@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
Gregory Clement <gregory.clement@bootlin.com>,
Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Huacai Chen <chenhuacai@kernel.org>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
Anup Patel <anup@brainfault.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev,
linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org
Cc: Nam Cao <namcao@linutronix.de>
Subject: [PATCH 09/12] irqchip/alpine-msi: Convert to __free
Date: Thu, 26 Jun 2025 16:49:06 +0200 [thread overview]
Message-ID: <ff2c9460d03e44cb2946521dbae5ce800d34523e.1750860131.git.namcao@linutronix.de> (raw)
In-Reply-To: <cover.1750860131.git.namcao@linutronix.de>
From: Thomas Gleixner <tglx@linutronix.de>
Tidy up the code with __free. No functional change.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Nam Cao <namcao@linutronix.de>
---
Cc: Antoine Tenart <atenart@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
---
drivers/irqchip/irq-alpine-msi.c | 31 ++++++++++++-------------------
1 file changed, 12 insertions(+), 19 deletions(-)
diff --git a/drivers/irqchip/irq-alpine-msi.c b/drivers/irqchip/irq-alpine-msi.c
index cf188e5feefc0..43d6db290138a 100644
--- a/drivers/irqchip/irq-alpine-msi.c
+++ b/drivers/irqchip/irq-alpine-msi.c
@@ -207,11 +207,10 @@ static int alpine_msix_init_domains(struct alpine_msix_data *priv, struct device
static int alpine_msix_init(struct device_node *node, struct device_node *parent)
{
- struct alpine_msix_data *priv;
+ struct alpine_msix_data *priv __free(kfree) = kzalloc(sizeof(*priv), GFP_KERNEL);
struct resource res;
int ret;
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
@@ -220,7 +219,7 @@ static int alpine_msix_init(struct device_node *node, struct device_node *parent
ret = of_address_to_resource(node, 0, &res);
if (ret) {
pr_err("Failed to allocate resource\n");
- goto err_priv;
+ return ret;
}
/*
@@ -235,34 +234,28 @@ static int alpine_msix_init(struct device_node *node, struct device_node *parent
if (of_property_read_u32(node, "al,msi-base-spi", &priv->spi_first)) {
pr_err("Unable to parse MSI base\n");
- ret = -EINVAL;
- goto err_priv;
+ return -EINVAL;
}
if (of_property_read_u32(node, "al,msi-num-spis", &priv->num_spis)) {
pr_err("Unable to parse MSI numbers\n");
- ret = -EINVAL;
- goto err_priv;
+ return -EINVAL;
}
- priv->msi_map = bitmap_zalloc(priv->num_spis, GFP_KERNEL);
- if (!priv->msi_map) {
- ret = -ENOMEM;
- goto err_priv;
- }
+ unsigned long *msi_map __free(kfree) = bitmap_zalloc(priv->num_spis, GFP_KERNEL);
+
+ if (!msi_map)
+ return -ENOMEM;
+ priv->msi_map = msi_map;
pr_debug("Registering %d msixs, starting at %d\n", priv->num_spis, priv->spi_first);
ret = alpine_msix_init_domains(priv, node);
if (ret)
- goto err_map;
+ return ret;
+ retain_and_null_ptr(priv);
+ retain_and_null_ptr(msi_map);
return 0;
-
-err_map:
- bitmap_free(priv->msi_map);
-err_priv:
- kfree(priv);
- return ret;
}
IRQCHIP_DECLARE(alpine_msix, "al,alpine-msix", alpine_msix_init);
--
2.39.5
next prev parent reply other threads:[~2025-06-26 14:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-26 14:48 [PATCH 00/12] irqchip: MSI cleanup and conversion to MSI parent domain Nam Cao
2025-06-26 14:48 ` [PATCH 01/12] irqdomain: Add device pointer to irq_domain_info and msi_domain_info Nam Cao
2025-06-26 14:48 ` [PATCH 02/12] irqchip/bcm2712-mip: Switch to msi_create_parent_irq_domain() Nam Cao
2025-06-26 16:12 ` Nam Cao
2025-06-26 14:49 ` [PATCH 03/12] irqchip/riscv-imsic: Convert to msi_create_parent_irq_domain() helper Nam Cao
2025-06-26 14:49 ` [PATCH 04/12] irqchip/imx-mu-msi: " Nam Cao
2025-06-26 16:08 ` Frank Li
2025-06-26 14:49 ` [PATCH 05/12] irqchip/loongson-pch-msi.c: Switch to msi_create_parent_irq_domain() Nam Cao
2025-06-26 14:49 ` [PATCH 06/12] irqchip/sg2042-msi: " Nam Cao
2025-06-28 2:01 ` Chen Wang
2025-06-26 14:49 ` [PATCH 07/12] irqchip/alpine-msi: Clean up whitespace style Nam Cao
2025-06-26 14:49 ` [PATCH 08/12] irqchip/alpine-msi: Convert to lock guards Nam Cao
2025-06-26 14:49 ` Nam Cao [this message]
2025-06-26 14:49 ` [PATCH 10/12] irqchip/alpine-msi: Switch to msi_create_parent_irq_domain() Nam Cao
2025-06-26 14:49 ` [PATCH 11/12] irqchip/armada-370-xp: " Nam Cao
2025-06-26 14:49 ` [PATCH 12/12] irqchip/ls-scfg-msi: Switch to use msi_create_parent_irq_domain() Nam Cao
2025-08-10 21:12 ` [PATCH 00/12] irqchip: MSI cleanup and conversion to MSI parent domain patchwork-bot+linux-riscv
2025-08-11 12:52 ` Thomas Gleixner
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=ff2c9460d03e44cb2946521dbae5ce800d34523e.1750860131.git.namcao@linutronix.de \
--to=namcao@linutronix.de \
--cc=alex@ghiti.fr \
--cc=andrew@lunn.ch \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=atenart@kernel.org \
--cc=chenhuacai@kernel.org \
--cc=festevam@gmail.com \
--cc=gregory.clement@bootlin.com \
--cc=imx@lists.linux.dev \
--cc=jiaxun.yang@flygoat.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=maz@kernel.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=s.hauer@pengutronix.de \
--cc=sebastian.hesselbarth@gmail.com \
--cc=shawnguo@kernel.org \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).