Re: [PATCH] kernel: resource: Remove unnecessary ‘0’ values from err

From: Andy Shevchenko
Date: Wed Jul 12 2023 - 11:57:24 EST


On Fri, Jul 14, 2023 at 07:53:39AM +0800, Li kunyu wrote:
> 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.

> - 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)

--
With Best Regards,
Andy Shevchenko