video: Convert CONFIG_VIDEO_LOGO to Kconfig
[platform/kernel/u-boot.git] / include / spi_flash.h
index 3d747c9..4d4ae89 100644 (file)
@@ -165,6 +165,9 @@ static inline int spi_flash_read(struct spi_flash *flash, u32 offset,
        struct mtd_info *mtd = &flash->mtd;
        size_t retlen;
 
+       if (!len)
+               return 0;
+
        return mtd->_read(mtd, offset, len, &retlen, buf);
 }
 
@@ -174,6 +177,9 @@ static inline int spi_flash_write(struct spi_flash *flash, u32 offset,
        struct mtd_info *mtd = &flash->mtd;
        size_t retlen;
 
+       if (!len)
+               return 0;
+
        return mtd->_write(mtd, offset, len, &retlen, buf);
 }
 
@@ -188,6 +194,9 @@ static inline int spi_flash_erase(struct spi_flash *flash, u32 offset,
                return -EINVAL;
        }
 
+       if (!len)
+               return 0;
+
        memset(&instr, 0, sizeof(instr));
        instr.addr = offset;
        instr.len = len;