[kbuild] drivers/mtd/nand/raw/nandsim.c:1792 ns_switch_state() error: we previously assumed 'ns->op' could be null (see line 1714)
CC: kbuild-...@lists.01.org CC: linux-ker...@vger.kernel.org TO: Miquel Raynal tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 1fe5501ba1abf2b7e78295df73675423bd6899a0 commit: 88f9f3e89a8ad1594c4d9c599bdf9c904e3976fe mtd: rawnand: nandsim: Use a consistent ns_ prefix for all functions date: 11 months ago :: branch date: 14 hours ago :: commit date: 11 months ago config: i386-randconfig-m031-20210421 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter smatch warnings: drivers/mtd/nand/raw/nandsim.c:1792 ns_switch_state() error: we previously assumed 'ns->op' could be null (see line 1714) vim +1792 drivers/mtd/nand/raw/nandsim.c ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1708 ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1709 /* ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1710 * Switch simulator's state. ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1711 */ 88f9f3e89a8ad1 drivers/mtd/nand/raw/nandsim.c Miquel Raynal2020-05-25 1712 static void ns_switch_state(struct nandsim *ns) ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1713 { ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 @1714 if (ns->op) { ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1715 /* ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1716 * The current operation have already been identified. ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1717 * Just follow the states chain. ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1718 */ ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1719 ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1720 ns->stateidx += 1; ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1721 ns->state = ns->nxstate; ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1722 ns->nxstate = ns->op[ns->stateidx + 1]; ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1723 ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1724 NS_DBG("switch_state: operation is known, switch to the next state, " ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1725 "state: %s, nxstate: %s\n", 88f9f3e89a8ad1 drivers/mtd/nand/raw/nandsim.c Miquel Raynal2020-05-25 1726 ns_get_state_name(ns->state), 88f9f3e89a8ad1 drivers/mtd/nand/raw/nandsim.c Miquel Raynal2020-05-25 1727 ns_get_state_name(ns->nxstate)); ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1728 ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1729 /* See, whether we need to do some action */ 88f9f3e89a8ad1 drivers/mtd/nand/raw/nandsim.c Miquel Raynal2020-05-25 1730 if ((ns->state & ACTION_MASK) && 88f9f3e89a8ad1 drivers/mtd/nand/raw/nandsim.c Miquel Raynal2020-05-25 1731 ns_do_state_action(ns, ns->state) < 0) { 88f9f3e89a8ad1 drivers/mtd/nand/raw/nandsim.c Miquel Raynal2020-05-25 1732 ns_switch_to_ready_state(ns, NS_STATUS_FAILED(ns)); ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1733 return; ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1734 } ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1735 ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1736 } else { ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1737 /* ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1738 * We don't yet know which operation we perform. ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1739 * Try to identify it. ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1740 */ ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1741 ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1742 /* ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1743 * The only event causing the switch_state function to ^1da177e4c3f41 drivers/mtd/nand/nandsim.c
[kbuild] drivers/mtd/nand/raw/nandsim.c:1792 ns_switch_state() error: we previously assumed 'ns->op' could be null (see line 1714)
CC: kbuild-...@lists.01.org CC: linux-ker...@vger.kernel.org TO: Miquel Raynal tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 1fe5501ba1abf2b7e78295df73675423bd6899a0 commit: 88f9f3e89a8ad1594c4d9c599bdf9c904e3976fe mtd: rawnand: nandsim: Use a consistent ns_ prefix for all functions date: 11 months ago :: branch date: 4 hours ago :: commit date: 11 months ago config: x86_64-randconfig-m031-20210420 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter smatch warnings: drivers/mtd/nand/raw/nandsim.c:1792 ns_switch_state() error: we previously assumed 'ns->op' could be null (see line 1714) vim +1792 drivers/mtd/nand/raw/nandsim.c ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1708 ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1709 /* ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1710 * Switch simulator's state. ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1711 */ 88f9f3e89a8ad1 drivers/mtd/nand/raw/nandsim.c Miquel Raynal2020-05-25 1712 static void ns_switch_state(struct nandsim *ns) ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1713 { ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 @1714 if (ns->op) { ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1715 /* ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1716 * The current operation have already been identified. ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1717 * Just follow the states chain. ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1718 */ ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1719 ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1720 ns->stateidx += 1; ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1721 ns->state = ns->nxstate; ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1722 ns->nxstate = ns->op[ns->stateidx + 1]; ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1723 ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1724 NS_DBG("switch_state: operation is known, switch to the next state, " ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1725 "state: %s, nxstate: %s\n", 88f9f3e89a8ad1 drivers/mtd/nand/raw/nandsim.c Miquel Raynal2020-05-25 1726 ns_get_state_name(ns->state), 88f9f3e89a8ad1 drivers/mtd/nand/raw/nandsim.c Miquel Raynal2020-05-25 1727 ns_get_state_name(ns->nxstate)); ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1728 ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1729 /* See, whether we need to do some action */ 88f9f3e89a8ad1 drivers/mtd/nand/raw/nandsim.c Miquel Raynal2020-05-25 1730 if ((ns->state & ACTION_MASK) && 88f9f3e89a8ad1 drivers/mtd/nand/raw/nandsim.c Miquel Raynal2020-05-25 1731 ns_do_state_action(ns, ns->state) < 0) { 88f9f3e89a8ad1 drivers/mtd/nand/raw/nandsim.c Miquel Raynal2020-05-25 1732 ns_switch_to_ready_state(ns, NS_STATUS_FAILED(ns)); ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1733 return; ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1734 } ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1735 ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1736 } else { ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1737 /* ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1738 * We don't yet know which operation we perform. ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1739 * Try to identify it. ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1740 */ ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1741 ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1742 /* ^1da177e4c3f41 drivers/mtd/nand/nandsim.c Linus Torvalds 2005-04-16 1743 * The only event causing the switch_state function to ^1da177e4c3f41 drivers/mtd/nand/nandsim.c