From: Albin Tonnerre Date: Sun, 14 Mar 2010 17:47:23 +0000 (+0100) Subject: drivers/mtd/spi/eeprom_m95xxx.c: add missing error checking X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=f852a0c3bfe0b30b4816135b9a0d2aaae7e5de6a;p=u-boot.git drivers/mtd/spi/eeprom_m95xxx.c: add missing error checking Signed-off-by: Albin Tonnerre --- diff --git a/drivers/mtd/spi/eeprom_m95xxx.c b/drivers/mtd/spi/eeprom_m95xxx.c index 0148d005e9..632db4e9e0 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;