riscv: propagate insert_resource result from add_resource
PATCH 1/1 riscv: propagate insert_resource result from add_resource
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).
--- arch/riscv/kernel/setup.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
arch/riscv/kernel/setup.c +3 -5
@@ -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 )
Quoted 16 lines · Thorsten Blum
Currently,
add_resource()returns 1 on success, even though its callers only check for negative values. Instead, propagate theinsert_resource()result fromadd_resource()to align with standard kernel return-value conventions (0 on success, negative errno on failure).Signed-off-by Thorsten Blum <[email protected]>--- arch/riscv/kernel/setup.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)arch/riscv/kernel/setup.c +0
-0@@ -71,16 +71,14 @@ static struct resource *standard_resources; static int __init add_resource(struct resource *parent,
arch/riscv/kernel/setup.c static struct resource *standard_resources; · line 79
Quoted 10 lines
arch/riscv/kernel/setup.c +2
-2struct 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);
Maybe just use %pR for the resource start/end here and avoid the casting.
Signature · 4 lines
Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius https://www.codethink.co.uk/privacy.html