i2c.c: Fix resource leak when I2C_FUNCS ioctl fails
authorBrendan Le Foll <brendan.le.foll@intel.com>
Tue, 20 Jan 2015 17:12:57 +0000 (17:12 +0000)
committerBrendan Le Foll <brendan.le.foll@intel.com>
Tue, 20 Jan 2015 17:15:13 +0000 (17:15 +0000)
This isn't a true failure condition just assume we have no features and carry
on

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
src/i2c/i2c.c

index ba7d051..5d87eac 100644 (file)
@@ -129,7 +129,7 @@ mraa_i2c_init_raw(unsigned int bus)
 
     if (ioctl(dev->fh, I2C_FUNCS, &dev->funcs) < 0) {
         syslog(LOG_CRIT, "i2c: Failed to get I2C_FUNC map from device");
-        return NULL;
+        dev->funcs = 0;
     }
 
     if (advance_func->i2c_init_post != NULL) {