mtd: nand: Error out if cmd_ctrl() is missing
authorAndrey Smirnov <andrew.smirnov@gmail.com>
Thu, 21 Jul 2016 21:59:20 +0000 (14:59 -0700)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Wed, 10 Aug 2016 14:12:50 +0000 (16:12 +0200)
commit2b3c2e2d759e7fbbbd2ebb880db141c74e2afeae
tree802fe6a25bf7e05aa900bbab87db191a0064f1dd
parent77d0b5844daeba4e7fc84028a41e73e70a8101cf
mtd: nand: Error out if cmd_ctrl() is missing

If no user specified chip->select_chip() function is provided, code in
nand_base.c will automatically set this hook to nand_select_chip(),
which in turn depends on chip->cmd_ctrl() hook being valid. Not
providing both of those functions in NAND controller driver (for example
by mistake) will result in a bit cryptic segfault. Same is true for
chip->cmdfunc().

To avoid the above scenario add a check in nand_scan_dent and error out
if cmd_ctrl() is not provided.

Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Suggested-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/nand/nand_base.c
This page took 0.02706 seconds and 5 git commands to generate.