Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1279627lqp; Fri, 22 Mar 2024 10:09:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXpSF4z6WcjdkwuUL2D+3nnfYfS3K8CDm6S0vsK30zj0zMs1YJyB8Q4Kd0Mr3L3Yp/rVgBftMVFAahJ06ywVMGvZ1VgGV/Van7vJInHSQ== X-Google-Smtp-Source: AGHT+IFgxcMmirgQQo/Jhh/evxWTqvBvvZmVQfnNUN4z0pJ7PRy3upmvjx5JRFal7l5MKeI+RAzm X-Received: by 2002:a1f:fe88:0:b0:4d4:5480:1bc2 with SMTP id l130-20020a1ffe88000000b004d454801bc2mr214976vki.14.1711127353978; Fri, 22 Mar 2024 10:09:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711127353; cv=pass; d=google.com; s=arc-20160816; b=R7nGsCm/WoTv+721rDdRx3Jsuw4C04UEwZK1kES0oCzOnY4LT+SE1cPH5aysJ/Tp/o B7DZKTNzXVGivfnz3OMPD7ElN1mrLoQAQU0Xe+WWtjudZnNFLfefTrQ6FQHZ7KlDomSA ueu8Qd3hSvw91s0DqGpd/gEf4ldNYXZ+Xt2OaSJ40CAcczWAe9P7dNIvXe0iYaV++lfx Vfq0Pgay0hHAOMIx5j3CESZ8/n3c90GvEA0mnIf34M+thlSUKuWpXkm9gORr0QkjP4On VUy+D2ZTZt1Xnf2zXvMn89w4S7LkiZ4W5vevkhlfTCihnd5R63liVHe84gm11HpAhPOw S6nQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=3D1O5TsE9+fdaaVNIft8GCQ86B4qaD0L5u0ldrl1oz4=; fh=AMjOZqZxH8CBgR6KGeiEqzMhLl9X/VuM4j/Zby9c++s=; b=UqSrh77JJK3gR5J+9OxzNFTu+rqp0UsJ7zuFUHa8QfNk6Uid3IjKnqiLlC4DlzDeTL 4Z0A69lfZQDSOLxg7ylbMkLLueOrtMAS/beCzbEfsBUfkOx7DnRR+nsqTbCoy9XH1+ym bcag2oKVoZP72y9s7vhYi32ZMJKe0RH18oPbqtaQ5oRGgGin7Idk4DIq5+Eaw93T0/pi lynDWj1CmrCQ4UB3w+aRmiI/7cgFiZy+MBaCKo526LIvAFvdwfDrIY9Qv3TF4iL72H+E y5jlcNTxVl3FUK143g1n6OFP76XZ5KflGj57xjG/KGheBQak2UNNtV2ElkcQv8qVtQcD bsnQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=ghiti.fr); spf=pass (google.com: domain of linux-kernel+bounces-111849-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111849-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b20-20020ac5c754000000b004d144d7592esi380402vkn.254.2024.03.22.10.09.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 10:09:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111849-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=ghiti.fr); spf=pass (google.com: domain of linux-kernel+bounces-111849-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111849-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 88AF51C221B3 for ; Fri, 22 Mar 2024 17:09:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B1FC65F87D; Fri, 22 Mar 2024 17:09:09 +0000 (UTC) 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