From 19415ff2e4ff863da0e4840e752aa282a8b403dd Mon Sep 17 00:00:00 2001 From: Brendan Le Foll Date: Tue, 13 May 2014 22:17:42 +0000 Subject: [PATCH] i2c: fixed impossible unsigned comparisons Signed-off-by: Brendan Le Foll --- src/i2c/i2c.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/i2c/i2c.c b/src/i2c/i2c.c index 1fb601e..df4dc57 100644 --- a/src/i2c/i2c.c +++ b/src/i2c/i2c.c @@ -28,7 +28,7 @@ maa_i2c_context* maa_i2c_init(int bus) { - unsigned int checked_pin = maa_check_i2c(bus); + int checked_pin = maa_check_i2c(bus); if (checked_pin < 0) { switch(checked_pin) { case -1: @@ -43,16 +43,12 @@ maa_i2c_init(int bus) default: return NULL; } } - return maa_i2c_init_raw(checked_pin); + return maa_i2c_init_raw((unsigned int) checked_pin); } maa_i2c_context* maa_i2c_init_raw(unsigned int bus) { - if (bus < 0) { - fprintf(stderr, "Bus -%u- bellow zero\n", bus); - return NULL; - } maa_i2c_context* dev = (maa_i2c_context*) malloc(sizeof(maa_i2c_context)); if (dev == NULL) return NULL;