Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp2711048imb; Mon, 4 Mar 2019 12:04:27 -0800 (PST) X-Google-Smtp-Source: APXvYqzpnrD/n7O+TR51q4VP0OJkjwBGoPfpHkhliORbW15LAzoP6IK6f/2xBIEjamkna4JH60gx X-Received: by 2002:a17:902:6684:: with SMTP id e4mr22176262plk.90.1551729867477; Mon, 04 Mar 2019 12:04:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551729867; cv=none; d=google.com; s=arc-20160816; b=0AY/lwvoOtrUwg5jlSGzUiP7S9xQ/Q0JtHHbTuO4HoP0fQ5lyrCNGH9gcJLOgTqW9a xNzeWAmBjycSI5tbyMhLojYG9KEZkqa592sZCcbXGHRFHi/+bBtlldxUMN1rTH9U78om e4MN89wCJI6sBktPAtmJO297wwNTaYuo+gMiv/qL+S+IKpk4wCaJpL+EmvRegGAUWznh KgRXZ0e9l+rbdomZeeiPvZUJ5H3lI8EE38L625VzfWDKLBlAt/N4CLGCHYDb/MBtYCze NvtHbUzW0z4rgguWd1GHW3uUn+DKXVV/6YXYsDoFt3HQOEO5OTsz1epR2DAIfcVrRjcc v2ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=SBGCw0iPPa716FgtNP/0EXYRdXcG/PT1ynscY4NLdF8=; b=BP8K/JqZbzPQ1B+awCp8uBjeekkwB6NMHDbUMALnbKF3PR1r54PsvU26RUfPoGQ1Iz AU5jVbCdH63+wCRmkcG5kecFEZcGXEerVWBRkaOz7k6RpwrcvHUtsi2pDd2JL1LtqwUW +EezoiAhoQP+D+rpO3xXQb9H87s826lpRulsp8AkF84ZsclgmZfVNZ49JBZkTc81lW3D ypWwzBWezhJainoqP3D4z8lSU50dzaPQGNj+AbhsSz0Tchpikf/qycPpCc/SM0HRkyfo uZqZCITvHjybfG1OlI7fAmO+0zPYgm/T7ns4laZddMeS28hhTmzm93yVDd7aTjsWumWB w3mg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y21si2343401plp.392.2019.03.04.12.04.12; Mon, 04 Mar 2019 12:04:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726182AbfCDUDH (ORCPT + 99 others); Mon, 4 Mar 2019 15:03:07 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:60273 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726066AbfCDUDG (ORCPT ); Mon, 4 Mar 2019 15:03:06 -0500 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.145]) with ESMTPA (Nemesis) id 1MlfCm-1hRkM03oKQ-00in5x; Mon, 04 Mar 2019 21:02:47 +0100 From: Arnd Bergmann 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@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] irqchip/imx-irqsteer: fix of_property_read_u32() error handling Date: Mon, 4 Mar 2019 21:02:18 +0100 Message-Id: <20190304200245.1196001-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 Content-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UdSSlNNUQDiid2ybnlmYnTXvA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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