From: Thorsten Blum <thorsten.blum@linux.dev>
To: "Paul Walmsley" <pjw@kernel.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alex@ghiti.fr>,
"Björn Töpel" <bjorn@rivosinc.com>,
"Conor Dooley" <conor.dooley@microchip.com>,
"Nam Cao" <namcao@linutronix.de>,
"Kuan-Wei Chiu" <visitorckw@gmail.com>,
"Klara Modin" <klarasmodin@gmail.com>,
"Han Gao" <rabenda.cn@gmail.com>, "Pu Lehui" <pulehui@huawei.com>
Cc: Thorsten Blum <thorsten.blum@linux.dev>,
Alexandre Ghiti <alexghiti@rivosinc.com>,
Yu-Chun Lin <eleanor.lin@realtek.com>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH] riscv: propagate insert_resource result from add_resource
Date: Tue, 12 May 2026 14:46:28 +0200 [thread overview]
Message-ID: <20260512124628.300360-3-thorsten.blum@linux.dev> (raw)
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).
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
arch/riscv/kernel/setup.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index c89cc272440b..6e3d8acae71a 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -71,16 +71,14 @@ 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) {
+ if (ret < 0)
pr_err("Failed to add a %s resource at %llx\n",
res->name, (unsigned long long) res->start);
- return ret;
- }
- return 1;
+ return ret;
}
static int __init add_kernel_resources(void)
next reply other threads:[~2026-05-12 12:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 12:46 Thorsten Blum [this message]
2026-05-12 12:49 ` [PATCH] riscv: propagate insert_resource result from add_resource Ben Dooks
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260512124628.300360-3-thorsten.blum@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=alex@ghiti.fr \
--cc=alexghiti@rivosinc.com \
--cc=aou@eecs.berkeley.edu \
--cc=bjorn@rivosinc.com \
--cc=conor.dooley@microchip.com \
--cc=eleanor.lin@realtek.com \
--cc=klarasmodin@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=namcao@linutronix.de \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=pulehui@huawei.com \
--cc=rabenda.cn@gmail.com \
--cc=visitorckw@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox