kernel: resource: Remove unnecessary ‘0’ values from err
PATCH 1/1 kernel: resource: Remove unnecessary ‘0’ values from err
err is assigned first, so it does not need to initialize the assignment.
Signed-off-by Li kunyu <[email protected]>
--- kernel/resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/resource.c +1 -1
@@ -656,7 +656,7 @@ static int reallocate_resource(struct resource *root, struct resource *old,resource_size_t newsize, struct resource_constraint *constraint) { - int err=0; + int err;struct resource new = *old;struct resource *conflict;
Signature · 1 line
2.18.2
Quoted 1 line · Li kunyu
err is assigned first, so it does not need to initialize the assignment.
While this is fine, I would go further to make it more explicit, i.e.
kernel/resource.c static int reallocate_resource(struct resource *root, struct resource *old, · line 661
Quoted 4 lines
kernel/resource.c +1
-1-int err=0 ; +int err;struct resource new = *old;struct resource *conflict;
- if ((err = __find_resource(root, old, &new, newsize, constraint)))
+ err = __find_resource(root, old, &new, newsize, constraint);
+ if (err)
Signature · 2 lines
With Best Regards, Andy Shevchenko