mtd: nand: Do not dereference before NULL check
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Thu, 31 Jul 2025 16:21:32 +0000 (17:21 +0100)
committerMichael Trimarchi <michael@amarulasolutions.com>
Sat, 23 Aug 2025 14:37:26 +0000 (16:37 +0200)
commit6b156c62ced25d3f8aed64c81e471353b56d0f2c
tree48c4465035fb12099158203a07f5a8a265d8c7ce
parentd246e70cf81d0a0d7cc49abd520c93df59d42e16
mtd: nand: Do not dereference before NULL check

In nanddev_init mtd and memorg are assigned values that dereference nand
but this happens before a NULL check for nand. Move the assignments
after the NULL check.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
drivers/mtd/nand/core.c