Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2940796lqp; Mon, 25 Mar 2024 13:53:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX2zu718UuxXOBHuZRaoziR2cbk0rJ3vflDS8Zfq9wDTnoW6W09mHpqLNqD/SCv6BnGgZfIWj/yysUdnElgaGp3GZg2NsO9xNPWyHv2cA== X-Google-Smtp-Source: AGHT+IFSJSm+H/NcJDBi6tyDG9rvg3BP7ChRNlpzP7Dz7fDXjEKZ4prszb5t6rMS0nPqZq0ulfGl X-Received: by 2002:a17:902:e74a:b0:1e0:c567:bb42 with SMTP id p10-20020a170902e74a00b001e0c567bb42mr3056636plf.59.1711399994947; Mon, 25 Mar 2024 13:53:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711399994; cv=pass; d=google.com; s=arc-20160816; b=as1QyCwxjOqZxQUb3G+ZSSOlRcVDc8ANGWUGuqlUrLgHwFCAwwIGENS5s0Gg2c57Dl j6K/ECwLvbT3rjHyPY9AVIDpb8za0AKbswjT++Wby53X9x5OsQtG9wZsqduwbXb0yNPS zMt6AbwTTPF9cf/aDsbyuoypjHZ9YnGSnMPc44edw1CHiKGMeFwLgKbTCRNLFDqJBiG7 VORN6WHLf1kjjBNK2ZugUQy58glWcrv5Otix1pjOF0jKg/wAeiJVA+7avNZQgMRUVvLx vf4qc3u5Djf+nWFJX4O2GVsApjvbHfl0Qnrru1xhcDzDf1aSfu9RVfhOUrnYRA93uKas uf2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=5B36+ryv2ceBpgxS6u/plE4v0cnxiR26BzlLQVQqVl0=; fh=AMjOZqZxH8CBgR6KGeiEqzMhLl9X/VuM4j/Zby9c++s=; b=ns1NeyH+n5mt9eN4xlZSCpcG90cLUYgTAfdWTNmgXh/OwLuuugiTJb0rjUMb+3A8l5 +ehCFmTh7gHo0ap75P8n2hxElvjKL9Z+RCwDcpqrFYcyPJfOMOsPMOkZjXzHPwxGjyKY Ho1wmw+lD4FM73+zD1buhjAcxTWq+PKgTrIVcjzNdF3SMJ8CkOb+QogaN1jNY1FfFs6p uBbcVnJW6DrnTfO68KFYnUvd7OO+dSJKieR0/mEo/6SRREARsfJ06zEa+P4v9AUG8dKp yJa/N9zeZEQ1W9OpuPgOa+0pPAZorhoExPyB+18BjCiXDgJQmn1yPtztFubAW9QdMlRs tHog==; 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-117979-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117979-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q14-20020a170902eb8e00b001e0c567bb4fsi2156782plg.376.2024.03.25.13.53.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 13:53:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117979-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=ghiti.fr); spf=pass (google.com: domain of linux-kernel+bounces-117979-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117979-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F02353216CF for ; Mon, 25 Mar 2024 20:50:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D62F5C919; Mon, 25 Mar 2024 20:46:09 +0000 (UTC) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (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 024625C613 for ; Mon, 25 Mar 2024 20:46:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.196 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711399568; cv=none; b=LESjkKtQ/gM7GUOhN4lkm9As3hioB8lAd7anLvS8YWnKpj5IxAWBeJ09CSSrMZnEZO3jxdiJUFgM7APK+jKR7t3iOeCyht9m4rfQGYkNQDys8XygcJjg4t8hEIP5j/y6mlG6x6R5pO3v6AMMfbU1vG74gAiRdYOsVjX+BYHEkQw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711399568; c=relaxed/simple; bh=VFo1mOaMAwLKVHt9nXePQ0nAnhVGcTNZ8psz1WZuNgA=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=rVlFKAgq/YJun/QF74pyPGqIlYreb1PLg5D/ttCaIKnia+foVTja/NXI54INfpZ4rR1ajztppFf5rJdprqrgjMGt+If7Wk5aUPQJiJGjZWPAeuiGsSTNtuD4Mlx6YobBy7zhEdG44LbD9fiEY52vyfBqlezq/T0szB/l5c+C6X4= 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.196 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 612F2E0004; Mon, 25 Mar 2024 20:45:59 +0000 (UTC) Message-ID: <0eeb142e-1c74-44f8-9f58-365bee3a670f@ghiti.fr> Date: Mon, 25 Mar 2024 21:45:59 +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 From: Alexandre Ghiti 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> <0a1e9afc-e999-451f-8d4f-670f7c15e609@ghiti.fr> In-Reply-To: <0a1e9afc-e999-451f-8d4f-670f7c15e609@ghiti.fr> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-GND-Sasl: alex@ghiti.fr Hi Qingfang, On 22/03/2024 18:08, Alexandre Ghiti wrote: > 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; > So this is actually already fixed in 6.9-rc1 by this commit: 956521064780 ("irqchip/sifive-plic: Parse number of interrupts and contexts early in plic_probe()"). Thanks, Alex > > You can add: > > Reviewed-by: Alexandre Ghiti > > Thanks, > > Alex > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv