* [PATCH] kernel: resource: Remove unnecessary ‘0’ values from err
@ 2023-07-13 23:53 Li kunyu
2023-07-12 15:57 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Li kunyu @ 2023-07-13 23:53 UTC (permalink / raw)
To: dan.j.williams, Jonathan.Cameron, gregkh, andriy.shevchenko,
rafael, ira.weiny
Cc: linux-kernel, Li kunyu
err is assigned first, so it does not need to initialize the assignment.
Signed-off-by: Li kunyu <kunyu@nfschina.com>
---
kernel/resource.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/resource.c b/kernel/resource.c
index b1763b2fd7ef..55a42f3c80be 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -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;
--
2.18.2
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] kernel: resource: Remove unnecessary ‘0’ values from err
2023-07-13 23:53 [PATCH] kernel: resource: Remove unnecessary ‘0’ values from err Li kunyu
@ 2023-07-12 15:57 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2023-07-12 15:57 UTC (permalink / raw)
To: Li kunyu
Cc: dan.j.williams, Jonathan.Cameron, gregkh, rafael, ira.weiny,
linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-12 15:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-13 23:53 [PATCH] kernel: resource: Remove unnecessary ‘0’ values from err Li kunyu
2023-07-12 15:57 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®