util/kconfig: Uprev to Linux 6.7's kconfig

Just a memory leak fix in Linux 6.7.

Change-Id: I1ff302dafa01e78429a30ff18e21ffe0b45ce46e
Signed-off-by: Patrick Georgi <patrick@coreboot.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80263
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Patrick Georgi 2024-01-30 23:37:11 +01:00
parent cc2ab49525
commit 3e397ddacb
3 changed files with 21 additions and 23 deletions

View File

@ -26,43 +26,43 @@ Index: kconfig/symbol.c
--- kconfig.orig/symbol.c --- kconfig.orig/symbol.c
+++ kconfig/symbol.c +++ kconfig/symbol.c
@@ -37,6 +37,7 @@ static struct symbol symbol_empty = { @@ -37,6 +37,7 @@ static struct symbol symbol_empty = {
struct symbol *modules_sym; struct symbol *modules_sym;
static tristate modules_val; static tristate modules_val;
+static int sym_warnings; +static int sym_warnings;
enum symbol_type sym_get_type(struct symbol *sym) enum symbol_type sym_get_type(struct symbol *sym)
{ {
@@ -319,12 +320,14 @@ static void sym_warn_unmet_dep(struct sy @@ -317,12 +318,14 @@ static void sym_warn_unmet_dep(struct sy
" Selected by [m]:\n"); " Selected by [m]:\n");
fputs(str_get(&gs), stderr); fputs(str_get(&gs), stderr);
+ sym_warnings++; + sym_warnings++;
} }
void sym_calc_value(struct symbol *sym) void sym_calc_value(struct symbol *sym)
{ {
struct symbol_value newval, oldval; struct symbol_value newval, oldval;
struct property *prop; struct property *prop;
+ const char *werror; + const char *werror;
struct expr *e; struct expr *e;
if (!sym) if (!sym)
@@ -340,8 +343,9 @@ void sym_calc_value(struct symbol *sym) @@ -338,8 +341,9 @@ void sym_calc_value(struct symbol *sym)
sym_calc_value(prop_get_symbol(prop)); sym_calc_value(prop_get_symbol(prop));
} }
+ werror = getenv("KCONFIG_WERROR"); + werror = getenv("KCONFIG_WERROR");
+ sym_warnings = 0; + sym_warnings = 0;
sym->flags |= SYMBOL_VALID; sym->flags |= SYMBOL_VALID;
- -
oldval = sym->curr; oldval = sym->curr;
switch (sym->type) { switch (sym->type) {
@@ -432,6 +436,9 @@ void sym_calc_value(struct symbol *sym) @@ -430,6 +434,9 @@ void sym_calc_value(struct symbol *sym)
; ;
} }
+ if (sym_warnings && werror) + if (sym_warnings && werror)
+ exit(1); + exit(1);
+ +

View File

@ -28,7 +28,7 @@ Index: kconfig/lexer.l
+++ kconfig/lexer.l +++ kconfig/lexer.l
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
%{ %{
#include <assert.h> #include <assert.h>
+#include <glob.h> +#include <glob.h>
#include <limits.h> #include <limits.h>
@ -37,7 +37,7 @@ Index: kconfig/lexer.l
@@ -439,6 +440,32 @@ void zconf_nextfile(const char *name) @@ -439,6 +440,32 @@ void zconf_nextfile(const char *name)
current_file = file; current_file = file;
} }
+void zconf_nextfiles(const char *wildcard) +void zconf_nextfiles(const char *wildcard)
+{ +{
+ glob_t g; + glob_t g;
@ -78,7 +78,7 @@ Index: kconfig/lkc.h
+void zconf_nextfiles(const char *name); +void zconf_nextfiles(const char *name);
int zconf_lineno(void); int zconf_lineno(void);
const char *zconf_curname(void); const char *zconf_curname(void);
Index: kconfig/parser.y Index: kconfig/parser.y
=================================================================== ===================================================================
--- kconfig.orig/parser.y --- kconfig.orig/parser.y
@ -91,4 +91,4 @@ Index: kconfig/parser.y
+ zconf_nextfiles($2); + zconf_nextfiles($2);
free($2); free($2);
}; };

View File

@ -123,9 +123,9 @@ static long long sym_get_range_val(struct symbol *sym, int base)
static void sym_validate_range(struct symbol *sym) static void sym_validate_range(struct symbol *sym)
{ {
struct property *prop; struct property *prop;
struct symbol *range_sym;
int base; int base;
long long val, val2; long long val, val2;
char str[64];
switch (sym->type) { switch (sym->type) {
case S_INT: case S_INT:
@ -141,17 +141,15 @@ static void sym_validate_range(struct symbol *sym)
if (!prop) if (!prop)
return; return;
val = strtoll(sym->curr.val, NULL, base); val = strtoll(sym->curr.val, NULL, base);
val2 = sym_get_range_val(prop->expr->left.sym, base); range_sym = prop->expr->left.sym;
val2 = sym_get_range_val(range_sym, base);
if (val >= val2) { if (val >= val2) {
val2 = sym_get_range_val(prop->expr->right.sym, base); range_sym = prop->expr->right.sym;
val2 = sym_get_range_val(range_sym, base);
if (val <= val2) if (val <= val2)
return; return;
} }
if (sym->type == S_INT) sym->curr.val = range_sym->curr.val;
sprintf(str, "%lld", val2);
else
sprintf(str, "0x%llx", val2);
sym->curr.val = xstrdup(str);
} }
static void sym_set_changed(struct symbol *sym) static void sym_set_changed(struct symbol *sym)