i2c: fixed impossible unsigned comparisons
authorBrendan Le Foll <brendan.le.foll@intel.com>
Tue, 13 May 2014 22:17:42 +0000 (22:17 +0000)
committerBrendan Le Foll <brendan.le.foll@intel.com>
Tue, 13 May 2014 22:17:42 +0000 (22:17 +0000)
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
src/i2c/i2c.c

index 1fb601e..df4dc57 100644 (file)
@@ -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;