mtd: sf: Make sure we don't register the same device twice
authorBoris Brezillon <boris.brezillon@bootlin.com>
Sun, 2 Dec 2018 09:54:25 +0000 (10:54 +0100)
committerJagan Teki <jagan@amarulasolutions.com>
Wed, 5 Dec 2018 19:15:36 +0000 (00:45 +0530)
commit492151b2093ee4df173f7e10da4938ef7c2a2156
treea8504809ea0a342aef1dc7b53d6565e9e2d0d819
parenta02820fca90ce9ccf243b3fce59c04dabd5671a8
mtd: sf: Make sure we don't register the same device twice

spi_flash_mtd_register() can be called several times and each time it
will register the same mtd_info instance like if it was a new one.
The MTD ID allocation gets crazy when that happens, so let's track the
status of the sf_mtd_info object to avoid that.

Fixes: 9fe6d8716e09 ("mtd, spi: Add MTD layer driver")
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Tested-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Jagan Teki <jagan@openedev.com>
drivers/mtd/spi/sf_mtd.c