Skip to contentSkip to conversation

kconfig: do not assign a variable in the return statement

PATCH In review Masahiro Yamada 1 participant 2 messages Apr 13, 2020 – Apr 25, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kconfig: do not assign a variable in the return statement

I am not a big fan of doing assignment in a return statement. Split it into two lines.

---

 scripts/kconfig/menu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/kconfig/menu.c +2 -1
index e436ba44c9c5..a5fbd6ccc006 100644
@@ -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)
Signature · 1 line
2.25.1
#1 lore raw
Quoted 5 lines · Masahiro Yamada

I am not a big fan of doing assignment in a return statement. Split it into two lines.

Applied to linux-kbuild.

Quoted 22 lines

---

 scripts/kconfig/menu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/kconfig/menu.c +2 -2
index e436ba44c9c5..a5fbd6ccc006 100644
@@ -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

Signature · 2 lines
Best Regards
Masahiro Yamada