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: 10838495 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1F0C01399 for ; Mon, 4 Mar 2019 20:03:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0AC972B477 for ; Mon, 4 Mar 2019 20:03:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08D912B518; Mon, 4 Mar 2019 20:03:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9F0822B477 for ; Mon, 4 Mar 2019 20:03:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=pMy2to/EaWvA2+CdPeqnoDY2YILLfCVFVIeuF5AcdWY=; b=q/S/v4XVQMZp4R 1/h7SX/iR5BAYs4dCdlJ8ci0BlsLU5JOrnmkiO2AjyEExPxJo54+wfhM6dIvH2CUK3gSF6XTeip1c Vx85Amrv4Nsw5TL0lV8X9gBfYMx400KGMjbVOGSOgxQuh191l7YCo+16uLkraAG+SHoMS0z9JZ/hh c/BHjX+Exq5kTA+AYW5bJgqYRbEsp29sWMd9ttACrbVrfPWymmZTP059DHsqss4ZJwTr+uI3aBnJz CcskKBlxL6JqvvVPRI8FqRfChkgD3PhSaZ6SxmkcSCiHCKbKY6fWCr7vALNWUkRRlSTNEzdQCyNol tLUqgxWdpZ5jY10tWKGg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h0tnk-0008C6-08; Mon, 04 Mar 2019 20:03:04 +0000 Received: from mout.kundenserver.de ([217.72.192.75]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h0tnh-0008BZ-0d for linux-arm-kernel@lists.infradead.org; Mon, 04 Mar 2019 20:03:02 +0000 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 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-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== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190304_120301_361517_73A6F2B8 X-CRM114-Status: GOOD ( 13.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aisheng Dong , Fugang Duan , Arnd Bergmann , linux-kernel@vger.kernel.org, NXP Linux Team , Pengutronix Kernel Team , Fabio Estevam , linux-arm-kernel@lists.infradead.org, Lucas Stach Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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.