]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
drivers/mtd/spi/eeprom_m95xxx.c: add missing error checking
authorAlbin Tonnerre <albin.tonnerre@free-electrons.com>
Sun, 14 Mar 2010 17:47:23 +0000 (18:47 +0100)
committerWolfgang Denk <wd@denx.de>
Fri, 9 Apr 2010 21:05:54 +0000 (23:05 +0200)
Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
drivers/mtd/spi/eeprom_m95xxx.c

index 0148d005e9dd5f334e24e0b1a7966d4fd9b61d8a..632db4e9e0a60c57ab94a4c54a2b2b9123cb42d0 100644 (file)
@@ -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;