From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754788AbdKNKTn (ORCPT ); Tue, 14 Nov 2017 05:19:43 -0500 Received: from foss.arm.com ([217.140.101.70]:54948 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752929AbdKNKTg (ORCPT ); Tue, 14 Nov 2017 05:19:36 -0500 From: Marc Zyngier To: Ard Biesheuvel Cc: Wei Yongjun , Thomas Gleixner , Jason Cooper , "linux-kernel\@vger.kernel.org" Subject: Re: [PATCH -next] irqchip/exiu: Fix return value check in exiu_init() In-Reply-To: (Ard Biesheuvel's message of "Tue, 14 Nov 2017 09:55:46 +0000") Organization: ARM Ltd References: <1510642648-123574-1-git-send-email-weiyongjun1@huawei.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Date: Tue, 14 Nov 2017 10:19:32 +0000 Message-ID: <87mv3prwln.fsf@on-the-bus.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 14 2017 at 9:55:46 am GMT, Ard Biesheuvel wrote: > On 14 November 2017 at 06:57, Wei Yongjun wrote: >> In case of error, the function of_iomap() returns NULL pointer not >> ERR_PTR(). The IS_ERR() test in the return value check should be >> replaced with NULL test. >> >> Fixes: 706cffc1b912 ("irqchip/exiu: Add support for Socionext Synquacer EXIU controller") >> Signed-off-by: Wei Yongjun >> --- >> drivers/irqchip/irq-sni-exiu.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/irqchip/irq-sni-exiu.c b/drivers/irqchip/irq-sni-exiu.c >> index 1b6e2f7..1927b2f 100644 >> --- a/drivers/irqchip/irq-sni-exiu.c >> +++ b/drivers/irqchip/irq-sni-exiu.c >> @@ -196,8 +196,8 @@ static int __init exiu_init(struct device_node *node, >> } >> >> data->base = of_iomap(node, 0); >> - if (IS_ERR(data->base)) { >> - err = PTR_ERR(data->base); >> + if (!data->base) { >> + err = -ENODEV; >> goto out_free; >> } >> > > I was going to blame Marc's Tegra code for this, because that is where > I copied most of the code from, but the bug doesn't exist there, and > so it appears to be an original work. Oops. Ah, nice try! ;-) > Acked-by: Ard Biesheuvel Applied to irqchip-4.15, thanks both. M. -- Jazz is not dead, it just smell funny.