From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-176.mta1.migadu.com (out-176.mta1.migadu.com [95.215.58.176]) (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 67A373D5C35 for ; Tue, 12 May 2026 17:21:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778606504; cv=none; b=Np9xKw4UdZOhwF3ZEvWgCISuDpMbGMOukh7ZQSJE1xO4BxUBanTsqp3+VtPauxjUZXeb+0Q80BbIweGkE/wsSEtX47tG+Z3bEuYc3an5KSAUdavZL2XHck7x6ABbFf8kZXhH+iHK9SrVxIydRGXTaSPpt9aeiurm2hXMiG5bT0w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778606504; c=relaxed/simple; bh=j5bUfBv5Xklbas5LVX1hMYzHdesKjuf0bScLDGs7I24=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=mVnuQ0zWGELWTe5P8ZG6xalOXkJDqW4kM4NR2uIvEQk3PWUzCNQ0EX3Qr4NtsgJFbtnYFlhBKnrjXglCQhEpyCPHYVF25Rgvl5KtVoLH7/w7w79VSbqpxTXqtnOIQkdWgkHmIvS1gKhLhAjErXXixAS0PKSgPhOKjZ2E2mLUfqc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Dd6ufYOC; arc=none smtp.client-ip=95.215.58.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Dd6ufYOC" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1778606499; 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; bh=doneI6Hkw8dD1ksg+soHfqrbwclZazg2GtaFjvBGONM=; b=Dd6ufYOCuspCUmri+/cve9fBn1NyY2KEefrsegIAKkb0bH+3fLnMj31AHPNQx1zyCA/yIe oZzJSQVs5IbrV+mLTvFheBawhGotH1bvEfsWDTDeB5RiaSWhgrKxo+lW2J/0zxrRHxKr10 jHVDgy+nh7OT9ewwb/vL/CCU02hCabM= From: Thorsten Blum To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Conor Dooley , Yu-Chun Lin , Kuan-Wei Chiu , Han Gao , Nam Cao , Pu Lehui , Klara Modin Cc: Ben Dooks , Thorsten Blum , Alexandre Ghiti , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] riscv: propagate insert_resource result from add_resource Date: Tue, 12 May 2026 19:20:35 +0200 Message-ID: <20260512172034.328405-4-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1360; i=thorsten.blum@linux.dev; h=from:subject; bh=DdMFF69dc0rPkx1YMplMpB+mcdSl27Da8CxlhC3ayAc=; b=owGbwMvMwCUWt7pQ4caZUj3G02pJDFnMiUlzzmR9Dp1z8tKLlaqCjfOi1BjFTdJknPV7Sq7Yq gjLHzvSUcrCIMbFICumyPJg1o8ZvqU1lZtMInbCzGFlAhnCwMUpABO595qR4WXRhcgZlwMrz8Ul bVt+e1HO94J3byu+fmI/zbP14/mzqwoZ/sftKZopc1Kg/oCfyknrHc33tz+62fh0scDW56YMhjv DrrIAAA== X-Developer-Key: i=thorsten.blum@linux.dev; a=openpgp; fpr=1D60735E8AEF3BE473B69D84733678FD8DFEEAD4 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Currently, add_resource() returns 1 on success, even though its callers only check for negative values. Instead, propagate the insert_resource() result from add_resource() to align with standard kernel return-value conventions (0 on success, negative errno on failure). Use %pR to print the full resource range while at it. Signed-off-by: Thorsten Blum --- Changes in v2: - Use %pR to print the full resource range as suggested by Ben Dooks - v1: https://lore.kernel.org/lkml/20260512124628.300360-3-thorsten.blum@linux.dev/ --- arch/riscv/kernel/setup.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index c89cc272440b..52d1d2b8f338 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -71,16 +71,13 @@ static struct resource *standard_resources; static int __init add_resource(struct resource *parent, struct resource *res) { - int ret = 0; + int ret; ret = insert_resource(parent, res); - if (ret < 0) { - pr_err("Failed to add a %s resource at %llx\n", - res->name, (unsigned long long) res->start); - return ret; - } + if (ret < 0) + pr_err("Failed to add resource %s %pR\n", res->name, res); - return 1; + return ret; } static int __init add_kernel_resources(void)