]> asedeno.scripts.mit.edu Git - linux.git/commit
mtd: spi-nor: Move condition to avoid a NULL check
authorTudor Ambarus <tudor.ambarus@microchip.com>
Fri, 25 Oct 2019 14:28:36 +0000 (14:28 +0000)
committerTudor Ambarus <tudor.ambarus@microchip.com>
Mon, 11 Nov 2019 18:42:52 +0000 (20:42 +0200)
commit9326b4e078cd99d3cae3c6c06b6f5893f8ea0c89
treec4b11ea6ec4c121e9292992517ab28a5458324e3
parentac82229d4e0a060194f66f44cb65fb98f3524e41
mtd: spi-nor: Move condition to avoid a NULL check

When the controller is not under the SPI-MEM interface it may implement
the optional controller_ops->erase() method.

nor->spimem and nor->controller_ops are mutually exclusive. Move the
nor->controller_ops->erase != NULL check as an 'else if' case to
nor->spimem, in order to avoid the nor->controller_ops != NULL
check.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
drivers/mtd/spi-nor/spi-nor.c