summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi
diff options
context:
space:
mode:
authorAlbin Tonnerre <albin.tonnerre@free-electrons.com>2010-03-14 18:47:23 +0100
committerWolfgang Denk <wd@denx.de>2010-04-09 23:05:54 +0200
commitf852a0c3bfe0b30b4816135b9a0d2aaae7e5de6a (patch)
treeb2d4528ddbf4bb78a73f29d5ed4a375fad7a14c4 /drivers/mtd/spi
parent74b86d2d51843a48b5ca4981173f95768e3466cc (diff)
downloadu-boot-imx-f852a0c3bfe0b30b4816135b9a0d2aaae7e5de6a.zip
u-boot-imx-f852a0c3bfe0b30b4816135b9a0d2aaae7e5de6a.tar.gz
u-boot-imx-f852a0c3bfe0b30b4816135b9a0d2aaae7e5de6a.tar.bz2
drivers/mtd/spi/eeprom_m95xxx.c: add missing error checking
Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
Diffstat (limited to 'drivers/mtd/spi')
-rw-r--r--drivers/mtd/spi/eeprom_m95xxx.c6
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;