[U-Boot] [PATCH] drivers/mtd/spi/eeprom_m95xxx.c: add missing error checking
Albin Tonnerre
albin.tonnerre at free-electrons.com
Sun Mar 14 18:47:23 CET 2010
Signed-off-by: Albin Tonnerre <albin.tonnerre at free-electrons.com>
---
drivers/mtd/spi/eeprom_m95xxx.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
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 @@ ssize_t spi_read (uchar *addr, int alen, uchar *buffer, int len)
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 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
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;
--
1.7.0
More information about the U-Boot
mailing list