mraa: Fix compiler warnings unused vars and useless statements
Should have 0 functionality effect, just cleans up a few things. Fixes #577 Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
@@ -309,7 +309,7 @@ mraa_iio_wait_event(int fd, char* data, int* read_size)
|
||||
|
||||
// Wait for it forever or until pthread_cancel
|
||||
// poll is a cancelable point like sleep()
|
||||
int x = poll(&pfd, 1, -1);
|
||||
poll(&pfd, 1, -1);
|
||||
|
||||
memset(data, 0, 100);
|
||||
*read_size = read(fd, data, 100);
|
||||
@@ -376,10 +376,7 @@ mraa_iio_get_event_data(mraa_iio_context dev)
|
||||
char buf[MAX_SIZE];
|
||||
char readbuf[32];
|
||||
int fd;
|
||||
int ret = 0;
|
||||
int padint = 0;
|
||||
int curr_bytes = 0;
|
||||
char shortbuf, signchar;
|
||||
|
||||
memset(buf, 0, MAX_SIZE);
|
||||
memset(readbuf, 0, 32);
|
||||
snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/" IIO_EVENTS, dev->num);
|
||||
@@ -441,7 +438,7 @@ mraa_iio_event_poll_nonblock(int fd, struct iio_event_data* data)
|
||||
|
||||
// Wait for it forever or until pthread_cancel
|
||||
// poll is a cancelable point like sleep()
|
||||
int x = poll(&pfd, 1, -1);
|
||||
poll(&pfd, 1, -1);
|
||||
|
||||
read(fd, data, sizeof(struct iio_event_data));
|
||||
|
||||
@@ -573,9 +570,7 @@ mraa_result_t
|
||||
mraa_iio_create_trigger(mraa_iio_context dev, const char* trigger)
|
||||
{
|
||||
struct stat configfs_status;
|
||||
struct stat trigger_status;
|
||||
char buf[MAX_SIZE];
|
||||
int ret;
|
||||
|
||||
if (stat(IIO_CONFIGFS_TRIGGER, &configfs_status) == 0) {
|
||||
memset(buf, 0, MAX_SIZE);
|
||||
|
||||
@@ -80,7 +80,6 @@ mraa_init_json_platform_platform(json_object* jobj_platform, mraa_board_t* board
|
||||
{
|
||||
json_object* jobj_temp = NULL;
|
||||
const char* temp_string = NULL;
|
||||
int temp_count = 0;
|
||||
int length = 0;
|
||||
mraa_result_t ret = MRAA_SUCCESS;
|
||||
|
||||
@@ -600,8 +599,8 @@ mraa_init_json_platform(const char* platform_json)
|
||||
mraa_result_t ret = MRAA_SUCCESS;
|
||||
char* buffer = NULL;
|
||||
struct stat st;
|
||||
int file_lock = 0, array_length = 0, i = 0;
|
||||
json_object *jobj_platform = NULL, *jobj_temp = NULL;
|
||||
int file_lock = 0, i = 0;
|
||||
json_object *jobj_platform = NULL;
|
||||
mraa_board_t* board = NULL;
|
||||
|
||||
// Try to lock the file for use
|
||||
|
||||
@@ -69,7 +69,6 @@ mraa_iio_info_t* plat_iio = NULL;
|
||||
mraa_lang_func_t* lang_func = NULL;
|
||||
|
||||
char* platform_name = NULL;
|
||||
static char* platform_long_name = NULL;
|
||||
|
||||
static int num_i2c_devices = 0;
|
||||
static int num_iio_devices = 0;
|
||||
@@ -953,7 +952,7 @@ mraa_find_i2c_bus(const char* devname, int startfrom)
|
||||
// i2c devices are numbered numerically so 0 must exist otherwise there is
|
||||
// no i2c-dev loaded
|
||||
if (mraa_file_exist("/sys/class/i2c-dev/i2c-0")) {
|
||||
for (i; i < num_i2c_devices; i++) {
|
||||
for (;i < num_i2c_devices; i++) {
|
||||
off_t size, err;
|
||||
snprintf(path, 64, "/sys/class/i2c-dev/i2c-%u/name", i);
|
||||
fd = open(path, O_RDONLY);
|
||||
|
||||
@@ -320,7 +320,7 @@ mraa_uart_ow_bit(mraa_uart_ow_context dev, uint8_t bit)
|
||||
/* return the bit present on the bus (0xff is a '1', anything else
|
||||
* (typically 0xfc or 0x00) is a 0
|
||||
*/
|
||||
if (_ow_read_byte(dev, &ch) == -1 || ret == -1) {
|
||||
if (_ow_read_byte(dev, &ch) != MRAA_SUCCESS || ret == -1) {
|
||||
return -1;
|
||||
}
|
||||
return (ch == 0xff);
|
||||
|
||||
@@ -89,7 +89,7 @@ mraa_intel_minnowboard_byt_compatible(mraa_boolean_t turbot)
|
||||
mraa_board_t* b = (mraa_board_t*) calloc(1, sizeof(mraa_board_t));
|
||||
|
||||
struct utsname running_uname;
|
||||
int uname_major, uname_minor, max_pins[28];
|
||||
int uname_major, uname_minor;
|
||||
|
||||
if (b == NULL) {
|
||||
return NULL;
|
||||
|
||||
@@ -86,7 +86,7 @@ mraa_up_board()
|
||||
mraa_board_t* b = (mraa_board_t*) calloc(1, sizeof(mraa_board_t));
|
||||
|
||||
struct utsname running_uname;
|
||||
int uname_major, uname_minor, max_pins[27];
|
||||
int uname_major, uname_minor;
|
||||
|
||||
if (b == NULL) {
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user