aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/menu.c')
-rw-r--r--scripts/kconfig/menu.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 7e83aef42c6d..8a8bc9be7831 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -183,7 +183,7 @@ void menu_add_option(int token, char *arg)
183 } 183 }
184} 184}
185 185
186static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2) 186static int menu_validate_number(struct symbol *sym, struct symbol *sym2)
187{ 187{
188 return sym2->type == S_INT || sym2->type == S_HEX || 188 return sym2->type == S_INT || sym2->type == S_HEX ||
189 (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name)); 189 (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name));
@@ -201,6 +201,15 @@ static void sym_check_prop(struct symbol *sym)
201 prop_warn(prop, 201 prop_warn(prop,
202 "default for config symbol '%s'" 202 "default for config symbol '%s'"
203 " must be a single symbol", sym->name); 203 " must be a single symbol", sym->name);
204 if (prop->expr->type != E_SYMBOL)
205 break;
206 sym2 = prop_get_symbol(prop);
207 if (sym->type == S_HEX || sym->type == S_INT) {
208 if (!menu_validate_number(sym, sym2))
209 prop_warn(prop,
210 "'%s': number is invalid",
211 sym->name);
212 }
204 break; 213 break;
205 case P_SELECT: 214 case P_SELECT:
206 sym2 = prop_get_symbol(prop); 215 sym2 = prop_get_symbol(prop);
@@ -220,8 +229,8 @@ static void sym_check_prop(struct symbol *sym)
220 if (sym->type != S_INT && sym->type != S_HEX) 229 if (sym->type != S_INT && sym->type != S_HEX)
221 prop_warn(prop, "range is only allowed " 230 prop_warn(prop, "range is only allowed "
222 "for int or hex symbols"); 231 "for int or hex symbols");
223 if (!menu_range_valid_sym(sym, prop->expr->left.sym) || 232 if (!menu_validate_number(sym, prop->expr->left.sym) ||
224 !menu_range_valid_sym(sym, prop->expr->right.sym)) 233 !menu_validate_number(sym, prop->expr->right.sym))
225 prop_warn(prop, "range is invalid"); 234 prop_warn(prop, "range is invalid");
226 break; 235 break;
227 default: 236 default: