Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp968521lqs; Fri, 14 Jun 2024 10:35:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWV1yQ+uUHzV8rGFDKhBzS2P8Ez9ldLpSjq1vuXvx5ZL1eSZEFYE25397uoXeddz2PVuvMosbhZlTGlp1rzyHYhVIy0aCT2zaHJX0krOA== X-Google-Smtp-Source: AGHT+IGbyay/nei6Orj7sWFK8urrlNxe9rmE2MM+2CdJDiYw5Tt+crg281/EN2bEvrgO736q9SZS X-Received: by 2002:a50:a458:0:b0:57a:322c:b1a5 with SMTP id 4fb4d7f45d1cf-57cbd6a6d1dmr2029397a12.38.1718386531031; Fri, 14 Jun 2024 10:35:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718386531; cv=pass; d=google.com; s=arc-20160816; b=Pt/u0WMwSQmAlHPCZFOvJZVa7QMSnrKwaEI+4cT65HdtYWs2DZIMZLyH/tj8JDRBZ4 Dai0TFUKv2Qi1SbdEydHA2Zz5qmJyFszJ9snUEx2GMVegMCvxcdVZ1KoOHWGJ8xnQ698 xRHZBFrLIRFaC/E9HAxsy47gwNF70bLweLnqYniXMKzxRJ99TxkaRZves7d0sH26rZaR 0+wERcMpFwJAgnDMTEiJzgtvh/eK7KL5a/SiZcMKpPLX02ajevCZy7Esoel5kcRCSVNr bb57WxXZnv6LAOUvPHg2F6GkCqzZ2f4KJQN4GaucQ7zRGkAkzdY88OET/FDVg3TOWtij VmJQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=6CVX37YYxogQc3necMFvOYHcfj0KlRLwJOiGoHdPMpg=; fh=bujJSrd+k1h/0aZbC1LeFD2/cY2NpcCgJFppOaBslqM=; b=HGPaU2QduaiydM4DRt0r65vUCK1zLp7ty3A3WqnjSOSlkMTCDej/iChJSzc5QTenWH MaEzJLLHf+PKix5hyN6+t1NUL6Y2QrgZNc7UjDtqPxCBVgH+dMxwMTEMG4e4z6wzMHKZ PsGV3vPdR56PyZZrNjrPIhyjn+0J1cejt3C5iIEabbL/61sfFPLDG3mwmNU2jHbCn1QY BG37KTPdEKi8a4Gt1NJY6gbQ1FWVEN12tYIpfYs3EHIkfeFxo3NaHoYGfbZt4WxIZWhA Z0d+vAh8gMVq3cFsLA7pf9SoI9Hb8BiM0wFqe4lruACbtfsAz663cmG0+bM3YCV1zJyG hvyQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=bOAGkTHf; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-215370-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215370-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57cb72d626fsi2012007a12.76.2024.06.14.10.35.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 10:35:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-215370-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=bOAGkTHf; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-215370-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215370-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id B51EC1F237AC for ; Fri, 14 Jun 2024 17:35:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BC781AC243; Fri, 14 Jun 2024 17:32:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="bOAGkTHf" Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) (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 45EF71A2FC4; Fri, 14 Jun 2024 17:32:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718386378; cv=none; b=ZT87njX3kAihXNchIEtCJR0UIAxS+ACCYE2sMtDSrDJML4OGoayp2yzec7rXUIX02n2dw5NFUMmzTA/jhyOAR3k5onOm81rsh62EEI+fMPuEUCqp8ATeTzly37y7uMcNcmjyD/NZSmmhpEAOJFB3n4Sc+yZJg7X2XphqLCixETE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718386378; c=relaxed/simple; bh=NrhshJgjm6LEY5OHT9wMuizZDHruRnog7t0GliFU43Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TQF9Vnp9eDu+C1WMtpPBHIw6rLJa872k8uydA0qvKPPmGuVw/rUn+UFOJ9bTR6UBHYNJGgEGN9h4PfZFYI1ZR/t6lhARLNbDB6Yd2uFKdVK4gS6SaJ2cTt+c+xxKX153H/vZE7G8cSWuj4QO5cIMAZ17+Fg8EviPdjLVxQZfG/A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=bOAGkTHf; arc=none smtp.client-ip=217.70.183.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPA id D4E0DFF80D; Fri, 14 Jun 2024 17:32:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1718386374; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6CVX37YYxogQc3necMFvOYHcfj0KlRLwJOiGoHdPMpg=; b=bOAGkTHf3Tt4ls6Rby+74mlUNWvvt7xuujriO8VAYqeS01DWwJH0z3FgQ768dyYI5qxHZb 8UdUmTgJXVMAyPT5BgpS4RHVp74FS2dH4X1tbsIR8biMD5IzhtOYhd57YiMEH8X1VibSEl xijuFc1C6ngU/B6VZB1TtARWw62kO+4C97kaHLPiP4smjQNUCOj9jSE7Q/S9hPz2/Ndewd Hk7SHuz84/Iaqvo8j0yY24EFji/ZveAoOWlTYW8aUq33KcWNoQ+w8t04mqdfRHRS/vKnt3 Y5OklgaaJ0wDlRNUH/4xrzsWwPLklEd5AoqGRdvZTq924IyaFOavphjhWeityg== From: Herve Codina To: Matti Vaittinen , Herve Codina , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Richard Weinberger , Anton Ivanov , Johannes Berg , Marc Zyngier Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-um@lists.infradead.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Thomas Petazzoni Subject: [PATCH 10/23] irqdomain: Make __irq_domain_create() return an error code Date: Fri, 14 Jun 2024 19:32:11 +0200 Message-ID: <20240614173232.1184015-11-herve.codina@bootlin.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240614173232.1184015-1-herve.codina@bootlin.com> References: <20240614173232.1184015-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: herve.codina@bootlin.com __irq_domain_create() can fail for several reasons. When it fails it returns a NULL pointer and so filters out the exact failure reason. The only user of __irq_domain_create() is irq_domain_instantiate() which can return a PTR_ERR value. On __irq_domain_create() failure, it uses an arbitrary error code. Rather than using this arbitrary error value, make __irq_domain_create() return is own error code and use that one. Signed-off-by: Herve Codina --- kernel/irq/irqdomain.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index edfd386be985..5090b1c572c6 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -187,17 +187,17 @@ static struct irq_domain *__irq_domain_create(const struct irq_domain_info *info if (WARN_ON((info->size && info->direct_max) || (!IS_ENABLED(CONFIG_IRQ_DOMAIN_NOMAP) && info->direct_max) || (info->direct_max && info->direct_max != info->hwirq_max))) - return NULL; + return ERR_PTR(-EINVAL); domain = kzalloc_node(struct_size(domain, revmap, info->size), GFP_KERNEL, of_node_to_nid(to_of_node(info->fwnode))); if (!domain) - return NULL; + return ERR_PTR(-ENOMEM); err = irq_domain_set_name(domain, info->fwnode); if (err) { kfree(domain); - return NULL; + return ERR_PTR(err); } domain->fwnode = fwnode_handle_get(info->fwnode); @@ -260,8 +260,8 @@ struct irq_domain *irq_domain_instantiate(const struct irq_domain_info *info) struct irq_domain *domain; domain = __irq_domain_create(info); - if (!domain) - return ERR_PTR(-ENOMEM); + if (IS_ERR(domain)) + return ERR_CAST(domain); domain->flags |= info->domain_flags; -- 2.45.0