[PATCH v2] i2cdetect: use break instead of goto in list_i2c_busses_and_exit()

Denys Vlasenko vda.linux at googlemail.com
Sun Jun 7 16:08:08 UTC 2015


Applied all five patches, thanks!

On Fri, Jun 5, 2015 at 10:47 AM, Bartosz Golaszewski
<bartekgola at gmail.com> wrote:
> Since there are no more statements in the if block after the while loop
> in list_i2c_busses_and_exit(), there's no need for a goto.
>
> Signed-off-by: Bartosz Golaszewski <bartekgola at gmail.com>
> ---
> NOTES: fixed two typos in the commit message.
>
>  miscutils/i2c_tools.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c
> index 2f501cd..38d90ff 100644
> --- a/miscutils/i2c_tools.c
> +++ b/miscutils/i2c_tools.c
> @@ -1226,12 +1226,11 @@ static void NORETURN list_i2c_busses_and_exit(void)
>                                                  i2cdev_path, de->d_name,
>                                                  subde->d_name);
>                                         fp = fopen(path, "r");
> -                                       goto found;
> +                                       break;
>                                 }
>                         }
>                 }
>
> -found:
>                 if (fp != NULL) {
>                         /*
>                          * Get the rest of the info and display a line
> --
> 2.1.4
>


More information about the busybox mailing list