From patchwork Mon Mar 4 20:02:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 159590 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp4156568jad; Mon, 4 Mar 2019 12:03:09 -0800 (PST) X-Google-Smtp-Source: APXvYqxw6LbLm2EuTf07qqEgw96AF88zWK56B912Kj3V8OKMMj33BQDUyhAdHeXApfyT0j4cJ8f/ X-Received: by 2002:a17:902:7202:: with SMTP id ba2mr21665295plb.147.1551729789181; Mon, 04 Mar 2019 12:03:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551729789; cv=none; d=google.com; s=arc-20160816; b=nz34ZyunAbZ7/HiXELiPluvxxUIRIO04AARuBwgmCoXFfjTVRyJgKPyG8HiG+tgE3P WitMhPrn6oz8P++sILHc+OrCbPHjkDbJxjNFmuzY+r5g601iiI/FMk6M2ruzU7QuoQu4 sIQGeWy3K9AgX92ss6yrEwyJ8hg6m3zBrDxr9wtWVaiGDM9Js5OjpFG2CxRL8FZwF319 y2F/eo94R56jqFzfCRtJQqXzMdIwjrHYEmEOJpOc7LWBmpvA1GWwhbpr+JRJY7ZKFDAi rNzEy7eTuRr/DmkaRVS9xIoMJHE9Tex6h2O3bvsLVa1FVbD9t5JIMbVb3sMTrCfOcy4S E6eQ== 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 g28si5923360pgm.455.2019.03.04.12.03.08; Mon, 04 Mar 2019 12:03:09 -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 S1726286AbfCDUDH (ORCPT + 31 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 X-Provags-ID: V03:K1:yY3QFfnoMqb8FAQm+o8mha9aY0xQW9ny5jcyC/eFkGeYR80Hap7 0GB2mC8XadjkBTtKoDV0IYKR3qIgbWXNdCvybLNLpi5h1R2gJutcL1/iJbIRKkoCCGWVEBZ cul5nOgjwK6cAvjq80scQiLCLTle9MFcNDy6pn4oFVcRs5vIuUW0VlO7fOXIxlkscCn+wYr En9Tp07HTjQOPrTRWgeVg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:86vfnA4Lj/s=:KtqfiSO+xP3Qx4JtaptNca 76l4Ex6B/TfJPAIDPMOPdWDu2OQ8pKMbFnAxRB0oMsi0+evTJQ65c4LiQ8eD0kQ8SNsSVqpLM F+LoemRQb4oHLxtxNSn6xT1n7bgN6f4JAVs2EoDXDH+Ze9ex4sMcW1galcQUggs2bgkmJ7ARS EY/TpmVjMF0g7danv6FwXgHiiyYX8Z2KvyJbLahaADUxxMzWXSN1Wl7SKbnKoub8YiWouDn7n GSRsZJUfZqJXgPhLqktxh794zspB9KHJf7hcd/IjtVP7ENY0YNE7uT/MYzR20abIKL7th6Zos vtu3E5LJXqGi0JZ/tOxlK/7z11sdhG+l409GdfnBcgaHfa6uBS+7LbdYqK+zC2fQxFKR3PTPR bCtVVK1gkImHbIXbFc8795JKCyG25QanOZ8vCp0H925FcpTA4Egct8fjhckqDNuLjIe3BeW1w 2PwsWYSDsGk9YfAstxX3RDxg3nF3O5n0VLGb9elSRvmUkKQx0xIthzN8a0kAZuTjaun/OZQ6H HrH7t9wNTo3BTPfB1wOG2JCZ0nHt98n0yAvF55sgBAmFdDy0LIIUPLz+tP0RaAi3UqYrP3wOX nubLMrn4ny8TNwHJ3KB//VT1Tctz7G/IKFKasPz9mbvPFaXHqRTKIW8yQOQVTEiHXjUv9Ppl/ TLLL5jIXS8Ie3uKEC3ezlaPV04zzc1UcuQdC3HfSxW1MJlVanmtagsa88yKFMPV+/8Ridvnls CBCqLZ3T10H/bUdSSlNNUQDiid2ybnlmYnTXvA== 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(-) -- 2.20.0 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.