]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
riscv: propagate insert_resource result from add_resource
authorThorsten Blum <thorsten.blum@linux.dev>
Sun, 7 Jun 2026 02:17:52 +0000 (20:17 -0600)
committerPaul Walmsley <pjw@kernel.org>
Sun, 7 Jun 2026 02:17:52 +0000 (20:17 -0600)
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 <thorsten.blum@linux.dev>
Link: https://patch.msgid.link/20260512172034.328405-4-thorsten.blum@linux.dev
Signed-off-by: Paul Walmsley <pjw@kernel.org>
arch/riscv/kernel/setup.c

index c89cc272440b9fbe6c9ba38805237dafa3d6b0c3..52d1d2b8f338b88530fcb0778d477810085b9ab5 100644 (file)
@@ -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)