diff mbox series

kconfig: do not assign a variable in the return statement

Message ID 20200413153542.94064-1-masahiroy@kernel.org (mailing list archive)
State New, archived
Headers show
Series kconfig: do not assign a variable in the return statement | expand

Commit Message

Masahiro Yamada April 13, 2020, 3:35 p.m. UTC
I am not a big fan of doing assignment in a return statement.
Split it into two lines.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/menu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Masahiro Yamada April 25, 2020, 5 p.m. UTC | #1
On Tue, Apr 14, 2020 at 12:35 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> I am not a big fan of doing assignment in a return statement.
> Split it into two lines.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>



Applied to linux-kbuild.

> ---
>
>  scripts/kconfig/menu.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
> index e436ba44c9c5..a5fbd6ccc006 100644
> --- a/scripts/kconfig/menu.c
> +++ b/scripts/kconfig/menu.c
> @@ -65,7 +65,8 @@ void menu_add_entry(struct symbol *sym)
>  struct menu *menu_add_menu(void)
>  {
>         last_entry_ptr = &current_entry->list;
> -       return current_menu = current_entry;
> +       current_menu = current_entry;
> +       return current_menu;
>  }
>
>  void menu_end_menu(void)
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index e436ba44c9c5..a5fbd6ccc006 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -65,7 +65,8 @@  void menu_add_entry(struct symbol *sym)
 struct menu *menu_add_menu(void)
 {
 	last_entry_ptr = &current_entry->list;
-	return current_menu = current_entry;
+	current_menu = current_entry;
+	return current_menu;
 }
 
 void menu_end_menu(void)