drivers/mtd/spi/eeprom_m95xxx.c: add missing error checking
Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
diff --git a/drivers/mtd/spi/eeprom_m95xxx.c b/drivers/mtd/spi/eeprom_m95xxx.c
index 0148d00..632db4e 100644
--- a/drivers/mtd/spi/eeprom_m95xxx.c
+++ b/drivers/mtd/spi/eeprom_m95xxx.c
@@ -44,6 +44,9 @@
slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 1000000,
CONFIG_DEFAULT_SPI_MODE);
+ if(!slave)
+ return 0;
+
spi_claim_bus(slave);
/* command */
@@ -75,6 +78,9 @@
slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 1000000,
CONFIG_DEFAULT_SPI_MODE);
+ if (!slave)
+ return 0;
+
spi_claim_bus(slave);
buf[0] = SPI_EEPROM_WREN;