* [PATCH] irqchip: Use int type to store negative error codes
@ 2025-08-29 13:20 Qianfeng Rong
2025-08-29 15:04 ` Marc Zyngier
0 siblings, 1 reply; 2+ messages in thread
From: Qianfeng Rong @ 2025-08-29 13:20 UTC (permalink / raw)
To: Marc Zyngier, Thomas Gleixner, linux-arm-kernel, linux-kernel
Cc: Qianfeng Rong
Change the 'ret' variable from unsigned int to int to store negative error
codes or zero returned by other functions.
Storing the negative error codes in unsigned type, doesn't cause an issue
at runtime but it's ugly. Additionally, assigning negative error codes to
unsigned type may trigger a GCC warning when the -Wsign-conversion flag is
enabled.
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
drivers/irqchip/irq-gic-v3.c | 3 ++-
drivers/irqchip/irq-nvic.c | 3 ++-
drivers/irqchip/irq-renesas-rza1.c | 3 ++-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index dbeb85677b08..3de351e66ee8 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -1766,8 +1766,9 @@ static int gic_irq_domain_select(struct irq_domain *d,
struct irq_fwspec *fwspec,
enum irq_domain_bus_token bus_token)
{
- unsigned int type, ret, ppi_idx;
+ unsigned int type, ppi_idx;
irq_hw_number_t hwirq;
+ int ret;
/* Not for us */
if (fwspec->fwnode != d->fwnode)
diff --git a/drivers/irqchip/irq-nvic.c b/drivers/irqchip/irq-nvic.c
index 76e11cac9631..2191a2b79578 100644
--- a/drivers/irqchip/irq-nvic.c
+++ b/drivers/irqchip/irq-nvic.c
@@ -73,8 +73,9 @@ static int __init nvic_of_init(struct device_node *node,
struct device_node *parent)
{
unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
- unsigned int irqs, i, ret, numbanks;
+ unsigned int irqs, i, numbanks;
void __iomem *nvic_base;
+ int ret;
numbanks = (readl_relaxed(V7M_SCS_ICTR) &
V7M_SCS_ICTR_INTLINESNUM_MASK) + 1;
diff --git a/drivers/irqchip/irq-renesas-rza1.c b/drivers/irqchip/irq-renesas-rza1.c
index a697eb55ac90..6047a524ac77 100644
--- a/drivers/irqchip/irq-renesas-rza1.c
+++ b/drivers/irqchip/irq-renesas-rza1.c
@@ -142,11 +142,12 @@ static const struct irq_domain_ops rza1_irqc_domain_ops = {
static int rza1_irqc_parse_map(struct rza1_irqc_priv *priv,
struct device_node *gic_node)
{
- unsigned int imaplen, i, j, ret;
struct device *dev = priv->dev;
+ unsigned int imaplen, i, j;
struct device_node *ipar;
const __be32 *imap;
u32 intsize;
+ int ret;
imap = of_get_property(dev->of_node, "interrupt-map", &imaplen);
if (!imap)
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] irqchip: Use int type to store negative error codes
2025-08-29 13:20 [PATCH] irqchip: Use int type to store negative error codes Qianfeng Rong
@ 2025-08-29 15:04 ` Marc Zyngier
0 siblings, 0 replies; 2+ messages in thread
From: Marc Zyngier @ 2025-08-29 15:04 UTC (permalink / raw)
To: Qianfeng Rong; +Cc: Thomas Gleixner, linux-arm-kernel, linux-kernel
On Fri, 29 Aug 2025 14:20:19 +0100,
Qianfeng Rong <rongqianfeng@vivo.com> wrote:
>
> Change the 'ret' variable from unsigned int to int to store negative error
> codes or zero returned by other functions.
>
> Storing the negative error codes in unsigned type, doesn't cause an issue
> at runtime but it's ugly. Additionally, assigning negative error codes to
> unsigned type may trigger a GCC warning when the -Wsign-conversion flag is
> enabled.
>
> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
For the GICv3 code:
Acked-by: Marc Zyngier <maz@kernel.org>
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-30 0:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-29 13:20 [PATCH] irqchip: Use int type to store negative error codes Qianfeng Rong
2025-08-29 15:04 ` Marc Zyngier
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).