diff options
Diffstat (limited to 'scripts/kconfig/menu.c')
-rw-r--r-- | scripts/kconfig/menu.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index b5c7d90df9df..fd3f0180e08f 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
@@ -146,11 +146,24 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e | |||
146 | struct menu *menu = current_entry; | 146 | struct menu *menu = current_entry; |
147 | 147 | ||
148 | while ((menu = menu->parent) != NULL) { | 148 | while ((menu = menu->parent) != NULL) { |
149 | struct expr *dup_expr; | ||
150 | |||
149 | if (!menu->visibility) | 151 | if (!menu->visibility) |
150 | continue; | 152 | continue; |
153 | /* | ||
154 | * Do not add a reference to the | ||
155 | * menu's visibility expression but | ||
156 | * use a copy of it. Otherwise the | ||
157 | * expression reduction functions | ||
158 | * will modify expressions that have | ||
159 | * multiple references which can | ||
160 | * cause unwanted side effects. | ||
161 | */ | ||
162 | dup_expr = expr_copy(menu->visibility); | ||
163 | |||
151 | prop->visible.expr | 164 | prop->visible.expr |
152 | = expr_alloc_and(prop->visible.expr, | 165 | = expr_alloc_and(prop->visible.expr, |
153 | menu->visibility); | 166 | dup_expr); |
154 | } | 167 | } |
155 | } | 168 | } |
156 | 169 | ||