public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2] kernel: resource: Remove unnecessary ‘0’ values from err
  2023-07-15 18:24 [PATCH v2] kernel: resource: Remove unnecessary ‘0’ values from err Li kunyu
@ 2023-07-14  2:32 ` Randy Dunlap
  2023-07-14  8:07 ` Andy Shevchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Randy Dunlap @ 2023-07-14  2:32 UTC (permalink / raw)
  To: Li kunyu, dan.j.williams, gregkh, Jonathan.Cameron, ira.weiny,
	bhelgaas, andriy.shevchenko
  Cc: linux-kernel



On 7/15/23 11:24, Li kunyu wrote:
> err is assigned first, so it does not need to initialize the assignment.
> Modify __find_resource execution syntax to make it more in line with
> commonly used styles.
> 
> Signed-off-by: Li kunyu <kunyu@nfschina.com>

Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Thanks.

> ---
>  v2:
>    Modify __find_resource Execution Syntax.
> 
>  kernel/resource.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/resource.c b/kernel/resource.c
> index b1763b2fd7ef..ee79e8f4f422 100644
> --- a/kernel/resource.c
> +++ b/kernel/resource.c
> @@ -656,13 +656,14 @@ 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;
>  
>  	write_lock(&resource_lock);
>  
> -	if ((err = __find_resource(root, old, &new, newsize, constraint)))
> +	err = __find_resource(root, old, &new, newsize, constraint);
> +	if (err)
>  		goto out;
>  
>  	if (resource_contains(&new, old)) {

-- 
~Randy

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] kernel: resource: Remove unnecessary ‘0’ values from err
  2023-07-15 18:24 [PATCH v2] kernel: resource: Remove unnecessary ‘0’ values from err Li kunyu
  2023-07-14  2:32 ` Randy Dunlap
@ 2023-07-14  8:07 ` Andy Shevchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2023-07-14  8:07 UTC (permalink / raw)
  To: Li kunyu
  Cc: dan.j.williams, gregkh, Jonathan.Cameron, ira.weiny, bhelgaas,
	linux-kernel

On Sun, Jul 16, 2023 at 02:24:28AM +0800, Li kunyu wrote:
> err is assigned first, so it does not need to initialize the assignment.
> Modify __find_resource execution syntax to make it more in line with
> commonly used styles.

FWIW,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Signed-off-by: Li kunyu <kunyu@nfschina.com>
> ---
>  v2:
>    Modify __find_resource Execution Syntax.
> 
>  kernel/resource.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/resource.c b/kernel/resource.c
> index b1763b2fd7ef..ee79e8f4f422 100644
> --- a/kernel/resource.c
> +++ b/kernel/resource.c
> @@ -656,13 +656,14 @@ 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;
>  
>  	write_lock(&resource_lock);
>  
> -	if ((err = __find_resource(root, old, &new, newsize, constraint)))
> +	err = __find_resource(root, old, &new, newsize, constraint);
> +	if (err)
>  		goto out;
>  
>  	if (resource_contains(&new, old)) {
> -- 
> 2.18.2
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] kernel: resource: Remove unnecessary ‘0’ values from err
@ 2023-07-15 18:24 Li kunyu
  2023-07-14  2:32 ` Randy Dunlap
  2023-07-14  8:07 ` Andy Shevchenko
  0 siblings, 2 replies; 3+ messages in thread
From: Li kunyu @ 2023-07-15 18:24 UTC (permalink / raw)
  To: dan.j.williams, gregkh, Jonathan.Cameron, ira.weiny, bhelgaas,
	andriy.shevchenko
  Cc: linux-kernel, Li kunyu

err is assigned first, so it does not need to initialize the assignment.
Modify __find_resource execution syntax to make it more in line with
commonly used styles.

Signed-off-by: Li kunyu <kunyu@nfschina.com>
---
 v2:
   Modify __find_resource Execution Syntax.

 kernel/resource.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/resource.c b/kernel/resource.c
index b1763b2fd7ef..ee79e8f4f422 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -656,13 +656,14 @@ 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;
 
 	write_lock(&resource_lock);
 
-	if ((err = __find_resource(root, old, &new, newsize, constraint)))
+	err = __find_resource(root, old, &new, newsize, constraint);
+	if (err)
 		goto out;
 
 	if (resource_contains(&new, old)) {
-- 
2.18.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-14  8:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-15 18:24 [PATCH v2] kernel: resource: Remove unnecessary ‘0’ values from err Li kunyu
2023-07-14  2:32 ` Randy Dunlap
2023-07-14  8:07 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox