* [PATCH] irqchip/imx-irqsteer: fix of_property_read_u32() error handling
@ 2019-03-04 20:02 Arnd Bergmann
2019-03-04 21:14 ` Marc Zyngier
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2019-03-04 20:02 UTC (permalink / raw)
To: Thomas Gleixner, Jason Cooper, Marc Zyngier, Shawn Guo, Sascha Hauer
Cc: Arnd Bergmann, Pengutronix Kernel Team, Fabio Estevam,
NXP Linux Team, Lucas Stach, Aisheng Dong, Fugang Duan,
linux-kernel, linux-arm-kernel
gcc points out that irqs_num is not initialized when of_property_read_u32()
is an empty stub function:
Included from drivers/irqchip/irq-imx-irqsteer.c:7:
drivers/irqchip/irq-imx-irqsteer.c: In function 'imx_irqsteer_probe':
include/uapi/linux/kernel.h:13:49: error: 'irqs_num' may be used uninitialized in this function [-Werror=maybe-uninitialized]
The same can actually happen with CONFIG_OF=y as well, though we don't
get a warning then.
Add error checking here that lets the code deal with missing or
invalid properties as well as avoid the warning.
Fixes: 28528fca4908 ("irqchip/imx-irqsteer: Add multi output interrupts support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/irqchip/irq-imx-irqsteer.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-imx-irqsteer.c b/drivers/irqchip/irq-imx-irqsteer.c
index d1098f4da6a4..88df3d00052c 100644
--- a/drivers/irqchip/irq-imx-irqsteer.c
+++ b/drivers/irqchip/irq-imx-irqsteer.c
@@ -169,8 +169,12 @@ static int imx_irqsteer_probe(struct platform_device *pdev)
raw_spin_lock_init(&data->lock);
- of_property_read_u32(np, "fsl,num-irqs", &irqs_num);
- of_property_read_u32(np, "fsl,channel", &data->channel);
+ ret = of_property_read_u32(np, "fsl,num-irqs", &irqs_num);
+ if (ret)
+ return ret;
+ ret = of_property_read_u32(np, "fsl,channel", &data->channel);
+ if (ret)
+ return ret;
/*
* There is one output irq for each group of 64 inputs.
--
2.20.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] irqchip/imx-irqsteer: fix of_property_read_u32() error handling
2019-03-04 20:02 [PATCH] irqchip/imx-irqsteer: fix of_property_read_u32() error handling Arnd Bergmann
@ 2019-03-04 21:14 ` Marc Zyngier
0 siblings, 0 replies; 2+ messages in thread
From: Marc Zyngier @ 2019-03-04 21:14 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Thomas Gleixner, Jason Cooper, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
Lucas Stach, Aisheng Dong, Fugang Duan, linux-kernel,
linux-arm-kernel
On Mon, 04 Mar 2019 20:02:18 +0000,
Arnd Bergmann <arnd@arndb.de> wrote:
>
> gcc points out that irqs_num is not initialized when of_property_read_u32()
> is an empty stub function:
>
> Included from drivers/irqchip/irq-imx-irqsteer.c:7:
> drivers/irqchip/irq-imx-irqsteer.c: In function 'imx_irqsteer_probe':
> include/uapi/linux/kernel.h:13:49: error: 'irqs_num' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>
> The same can actually happen with CONFIG_OF=y as well, though we don't
> get a warning then.
>
> Add error checking here that lets the code deal with missing or
> invalid properties as well as avoid the warning.
>
> Fixes: 28528fca4908 ("irqchip/imx-irqsteer: Add multi output interrupts support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/irqchip/irq-imx-irqsteer.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
Applied, thanks Arnd.
M.
--
Jazz is not dead, it just smell funny.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-04 21:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-04 20:02 [PATCH] irqchip/imx-irqsteer: fix of_property_read_u32() error handling Arnd Bergmann
2019-03-04 21:14 ` 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).