Private
Public Access
2
0

beaglebone.c: check devpath only once in i2c_init_pre

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Tapani Utriainen
2017-07-27 15:42:25 +08:00
committed by Brendan Le Foll
parent 46e5aab56e
commit 0b1ccf526f

View File

@@ -266,9 +266,6 @@ mraa_beaglebone_i2c_init_pre(unsigned int bus)
snprintf(devpath, MAX_SIZE, "/dev/i2c-%u", bus);
if (!mraa_file_exist(devpath)) {
ret = MRAA_ERROR_INVALID_HANDLE;
}
if (mraa_file_exist(devpath)) {
// Bus 1 doesn't seem to be configurable
if (bus == 0) {
@@ -281,6 +278,7 @@ mraa_beaglebone_i2c_init_pre(unsigned int bus)
return MRAA_SUCCESS;
} else {
syslog(LOG_ERR, "i2c: Device %s not initialized", devpath);
ret = MRAA_ERROR_INVALID_HANDLE;
}
return ret;
}