diff mbox

[1/1] tools/xsplice: cleanup unnecessary "j = ARRAY_SIZE(action_options); "

Message ID 1464572762-12143-1-git-send-email-dongli.zhang@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dongli Zhang May 30, 2016, 1:46 a.m. UTC
Local variable "j" would be used only when "i == ARRAY_SIZE(main_options)"
is true. Thus, it is not necessary to update "j" when "i ==
ARRAY_SIZE(main_options)" is false.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
---
 tools/misc/xen-xsplice.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Konrad Rzeszutek Wilk May 31, 2016, 9:02 p.m. UTC | #1
On Mon, May 30, 2016 at 09:46:02AM +0800, Dongli Zhang wrote:
> Local variable "j" would be used only when "i == ARRAY_SIZE(main_options)"
> is true. Thus, it is not necessary to update "j" when "i ==
> ARRAY_SIZE(main_options)" is false.
> 
> Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

Wei, it is up to you whether it should go in 4.7 or in 4.8.
This is a cleanup so it has no effect on the code.

> ---
>  tools/misc/xen-xsplice.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tools/misc/xen-xsplice.c b/tools/misc/xen-xsplice.c
> index ddaa079..811dc57 100644
> --- a/tools/misc/xen-xsplice.c
> +++ b/tools/misc/xen-xsplice.c
> @@ -435,8 +435,7 @@ int main(int argc, char *argv[])
>                     "'xen-xsplice help'\n", argv[1]);
>              return 1;
>          }
> -    } else
> -        j = ARRAY_SIZE(action_options);
> +    }
>  
>      xch = xc_interface_open(0,0,0);
>      if ( !xch )
> -- 
> 1.9.1
>
Wei Liu June 1, 2016, 10:14 a.m. UTC | #2
On Tue, May 31, 2016 at 05:02:50PM -0400, Konrad Rzeszutek Wilk wrote:
> On Mon, May 30, 2016 at 09:46:02AM +0800, Dongli Zhang wrote:
> > Local variable "j" would be used only when "i == ARRAY_SIZE(main_options)"
> > is true. Thus, it is not necessary to update "j" when "i ==
> > ARRAY_SIZE(main_options)" is false.
> > 
> > Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
> 
> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> Wei, it is up to you whether it should go in 4.7 or in 4.8.
> This is a cleanup so it has no effect on the code.
> 

This can wait.

You obviously have more important code churn then this. Do want to make
your life harder.

Wei.

> > ---
> >  tools/misc/xen-xsplice.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/tools/misc/xen-xsplice.c b/tools/misc/xen-xsplice.c
> > index ddaa079..811dc57 100644
> > --- a/tools/misc/xen-xsplice.c
> > +++ b/tools/misc/xen-xsplice.c
> > @@ -435,8 +435,7 @@ int main(int argc, char *argv[])
> >                     "'xen-xsplice help'\n", argv[1]);
> >              return 1;
> >          }
> > -    } else
> > -        j = ARRAY_SIZE(action_options);
> > +    }
> >  
> >      xch = xc_interface_open(0,0,0);
> >      if ( !xch )
> > -- 
> > 1.9.1
> >
Wei Liu June 9, 2016, 3:21 p.m. UTC | #3
On Mon, May 30, 2016 at 09:46:02AM +0800, Dongli Zhang wrote:
> Local variable "j" would be used only when "i == ARRAY_SIZE(main_options)"
> is true. Thus, it is not necessary to update "j" when "i ==
> ARRAY_SIZE(main_options)" is false.
> 
> Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
> ---
>  tools/misc/xen-xsplice.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tools/misc/xen-xsplice.c b/tools/misc/xen-xsplice.c
> index ddaa079..811dc57 100644
> --- a/tools/misc/xen-xsplice.c
> +++ b/tools/misc/xen-xsplice.c
> @@ -435,8 +435,7 @@ int main(int argc, char *argv[])
>                     "'xen-xsplice help'\n", argv[1]);
>              return 1;
>          }
> -    } else
> -        j = ARRAY_SIZE(action_options);
> +    }
>  

And of course since xsplice doesn't exist anymore, this patch won't
apply.

Dongli, can you resubmit this patch and update the subject line
accordingly?

You can of course keep Konrad's Review-by tag. I don't expect him to
object.

Wei.

>      xch = xc_interface_open(0,0,0);
>      if ( !xch )
> -- 
> 1.9.1
>
diff mbox

Patch

diff --git a/tools/misc/xen-xsplice.c b/tools/misc/xen-xsplice.c
index ddaa079..811dc57 100644
--- a/tools/misc/xen-xsplice.c
+++ b/tools/misc/xen-xsplice.c
@@ -435,8 +435,7 @@  int main(int argc, char *argv[])
                    "'xen-xsplice help'\n", argv[1]);
             return 1;
         }
-    } else
-        j = ARRAY_SIZE(action_options);
+    }
 
     xch = xc_interface_open(0,0,0);
     if ( !xch )