From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF7465D8F0 for ; Fri, 22 Mar 2024 17:09:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711127349; cv=none; b=f+Du17/Mw81ElUdE4GTwko9SSajwQLlLLLAs0CPMSqZ8rV5asHlS5mlkXx9KcCD1FKYKTcvQ1GL3djIn/DFo5pYSOrO/yLiBmJHj+2Wdgo2h604YqdctXjxZQQ7UxVGrT26B2DuYgUvIYSLtGqUMnCH1S5834R0fSRrECz/fZwI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711127349; c=relaxed/simple; bh=e6nWyD6TjJq8QDK1Xb2Y39EeCBOjqWyjA8FxmeUfZ3A=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=EoLxPnOyvZNkHbc4h2uv/SRV2FmAm9SQEKAKo9WCQHk1ml6B3+P4F5ODw0/IQ6rvNSIx5bZv5WaBX15Vg05VJ92cotsVXLWBhQu1HhRdkpN2Cflu5wgF3uj5TOYDGDaIMQG1NaBPXnz6e+9oMe9ge64yxefZk9gJJ9lSZG2QwiQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ghiti.fr; spf=pass smtp.mailfrom=ghiti.fr; arc=none smtp.client-ip=217.70.183.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ghiti.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ghiti.fr Received: by mail.gandi.net (Postfix) with ESMTPSA id 7849F40007; Fri, 22 Mar 2024 17:08:55 +0000 (UTC) Message-ID: <0a1e9afc-e999-451f-8d4f-670f7c15e609@ghiti.fr> Date: Fri, 22 Mar 2024 18:08:55 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] irqchip/sifive-plic: Fix error handling of of_property_read_u32 Content-Language: en-US To: Qingfang Deng , Thomas Gleixner , Palmer Dabbelt , Paul Walmsley , Albert Ou , Atish Patra , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Cc: Christoph Hellwig , Qingfang Deng References: <20240322090002.311645-1-dqfext@gmail.com> From: Alexandre Ghiti In-Reply-To: <20240322090002.311645-1-dqfext@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-GND-Sasl: alex@ghiti.fr Hi Qingfang, On 22/03/2024 10:00, Qingfang Deng wrote: > From: Qingfang Deng > > nr_irqs will not be initialized if of_property_read_u32 returns an > error. Check the error first. > > Fixes: 8237f8bc4f6e ("irqchip: add a SiFive PLIC driver") > Signed-off-by: Qingfang Deng > --- > drivers/irqchip/irq-sifive-plic.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c > index 5b7bc4fd9517..f436b61d74b0 100644 > --- a/drivers/irqchip/irq-sifive-plic.c > +++ b/drivers/irqchip/irq-sifive-plic.c > @@ -428,8 +428,11 @@ static int __init __plic_init(struct device_node *node, > goto out_free_priv; > } > > + error = of_property_read_u32(node, "riscv,ndev", &nr_irqs); > + if (error) > + goto out_iounmap; > + > error = -EINVAL; > - of_property_read_u32(node, "riscv,ndev", &nr_irqs); > if (WARN_ON(!nr_irqs)) > goto out_iounmap; > You can add: Reviewed-by: Alexandre Ghiti Thanks, Alex