OSDN Git Service

[BUG][I2C_ROM] Fix unsave on i2c_eeprom_burst_write().
authorK.Ohta <whatisthis.sowhat@gmail.com>
Mon, 26 Aug 2013 13:39:20 +0000 (22:39 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Mon, 26 Aug 2013 13:39:20 +0000 (22:39 +0900)
i2c_eeprom.c

index 9046628..559e2c2 100644 (file)
@@ -151,11 +151,11 @@ unsigned char i2c_eeprom_burstwrite(unsigned char i2caddr, unsigned int addr, un
         bb = I2C_ROM_PAGE_SIZE - (addr % I2C_ROM_PAGE_SIZE);
         if(b <= bb) bb = b;
         sts = i2c_eeprom_write_1block(i2caddr, addr, data, bb);
+        if(sts == 0) return 0;
         b -= bb;
         addr += bb;
         data += bb;
     }
-    if(sts == 0) return 0;
 
     while(b >= I2C_ROM_PAGE_SIZE){
         sts = i2c_eeprom_write_1block(i2caddr,  addr, data, I2C_ROM_PAGE_SIZE);