Commit e5e10c028918b58e16e8413560076e550fd9ab41

Authored by Peter Kümmel
Committed by Greg Kroah-Hartman
1 parent 4fb5076bf3

kconfig: Fix warning "‘jump’ may be used uninitialized"

commit 2d560306096739e2251329ab5c16059311a151b0 upstream.

Warning:
In file included from scripts/kconfig/zconf.tab.c:2537:0:
scripts/kconfig/menu.c: In function ‘get_symbol_str’:
scripts/kconfig/menu.c:590:18: warning: ‘jump’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     jump->offset = strlen(r->s);

Simplifies the test logic because (head && local) means (jump != 0)
and makes GCC happy when checking if the jump pointer was initialized.

Signed-off-by: Peter Kümmel <syntheticpp@gmx.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

scripts/kconfig/menu.c
... ... @@ -548,7 +548,7 @@
548 548 {
549 549 int i, j;
550 550 struct menu *submenu[8], *menu, *location = NULL;
551   - struct jump_key *jump;
  551 + struct jump_key *jump = NULL;
552 552  
553 553 str_printf(r, _("Prompt: %s\n"), _(prop->text));
554 554 menu = prop->menu->parent;
... ... @@ -586,7 +586,7 @@
586 586 str_printf(r, _(" Location:\n"));
587 587 for (j = 4; --i >= 0; j += 2) {
588 588 menu = submenu[i];
589   - if (head && location && menu == location)
  589 + if (jump && menu == location)
590 590 jump->offset = strlen(r->s);
591 591 str_printf(r, "%*c-> %s", j, ' ',
592 592 _(menu_get_prompt(menu)));