Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9668403pxu; Tue, 29 Dec 2020 01:29:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyEotBuHh80kGokkOe3BS2j5cGUVtvUR14lkQ21VJMABKQ477lpLpHXkq0QubodWn3eSjW X-Received: by 2002:a17:906:edd2:: with SMTP id sb18mr46181064ejb.114.1609234157339; Tue, 29 Dec 2020 01:29:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609234157; cv=none; d=google.com; s=arc-20160816; b=Ob/WO3oW+ABJ87sH2zy3hmLf+pgbfganVplTNjRSF1cLHbcrRM62caHhgPL5Mopa1z TBiX5f+gOU3CtnDCvw9dAXawHevVorb30XWTYbGT1ECrvyb5cNkkNP7OswzfHmJT8ttz sAzFsHbV3Vq83j/jpHUgILRY1kCuiZy1aLm1CS2uvLUYDP/qsAaemc2/HkU/xKeLg7Vq UX+ei2AhtIzrbUtHeMcchB5Z1UEwxncffy/0FxcTSb6HFTnh8ytdmnoto2CvDf8+RVgf ZSHPHu6r39dfLMY/hfN6/h48uYXgvT7pux7cUWgypvNwdP9pdfDJnnwnpz0JsagdYiQD Of9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version; bh=8G7S80/9nvCGIhAxry2zBhk/SV4MV6ar18Ol9PjFNSE=; b=an42FprKKDzBhcFcyb7oOrqDFbENmNJQLGiBNbG2zZwE1a3AfHxtC46veb7DMHL0+1 O/7QAaX4RsCltuHox1iiUkEp3TOD7ljngW7P//+XX+Q9xpsCMjlIV4gLxLFwcuy1NMIh uJIlAhtCgfY+VIUYiHdGt6NXYcgbdq19a33ozxCSzj0EgTmt+WSkGlRMZhrAMs5FzmsA yAB4leD/VqRC7p3wvQG24tFOq0TN/uO4wJIW8rDVCYrFE3UiP6/YzG0/013GQLkFyqw0 Pe2HXvQ8xFxFMc5Q1KVCAf18rD0u1Ym7p1VBQ0z0EL/5Jbja/OYm/iWU4YsJhi6V/VTz oa3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p5si9044770edt.50.2020.12.29.01.28.53; Tue, 29 Dec 2020 01:29:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726197AbgL2J2Y (ORCPT + 99 others); Tue, 29 Dec 2020 04:28:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:56726 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725866AbgL2J2X (ORCPT ); Tue, 29 Dec 2020 04:28:23 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CAD26207D1; Tue, 29 Dec 2020 09:27:42 +0000 (UTC) Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1kuBI4-004OBp-Q4; Tue, 29 Dec 2020 09:27:40 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 29 Dec 2020 09:27:40 +0000 From: Marc Zyngier To: Yejune Deng Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org Subject: Re: [PATCH] irqchip/gic: add WARN_ON() to facilitate backtracking In-Reply-To: <1609226114-32933-1-git-send-email-yejune.deng@gmail.com> References: <1609226114-32933-1-git-send-email-yejune.deng@gmail.com> User-Agent: Roundcube Webmail/1.4.9 Message-ID: <36538faa77fd0e34f559ec547b983c72@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: yejune.deng@gmail.com, tglx@linutronix.de, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Yejune, On 2020-12-29 07:15, Yejune Deng wrote: > There is two function gic_of_init() and gic_of_init_child() called > gic_of_setup(),so add WARN_ON() to facilitate backtracking. > > Signed-off-by: Yejune Deng > --- > drivers/irqchip/irq-gic.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c > index b1d9c22..7c11705 100644 > --- a/drivers/irqchip/irq-gic.c > +++ b/drivers/irqchip/irq-gic.c > @@ -1380,7 +1380,7 @@ static bool gic_check_eoimode(struct device_node > *node, void __iomem **base) > > static int gic_of_setup(struct gic_chip_data *gic, struct device_node > *node) > { > - if (!gic || !node) > + if (WARN_ON(!gic || !node)) > return -EINVAL; > > gic->raw_dist_base = of_iomap(node, 0); I don't immediately see what you gain with this. If you end-up here with NULL pointers, that either because: - you have failed to allocate the GIC private data structure: but as it turns out, these allocations either cannot fail (gic_data[] is static), or the dynamic allocation in gic_of_init_child() is already checked. - node is NULL: both paths already check for a NULL node, so that cannot fail either. My conclusion is that these checks can never trigger, and we should be able to *remove* them altogether. Am I missing something? M. -- Jazz is not dead. It just smells funny...