libx52: Clean up compiler warnings

pull/22/head
nirenjan 2020-06-11 23:29:20 -07:00
parent 65c889827a
commit 3b8b98e74c
4 changed files with 31 additions and 4 deletions

View File

@ -262,6 +262,7 @@ static int _x52_write_time(libx52_device *x52, uint32_t bit)
uint16_t value = 0;
uint16_t index;
libx52_clock_id clock;
uint16_t h24;
switch (bit) {
case X52_BIT_MFD_TIME:
@ -276,9 +277,12 @@ static int _x52_write_time(libx52_device *x52, uint32_t bit)
clock = LIBX52_CLOCK_3;
index = X52_OFFS_CLOCK3;
break;
default:
/* We should never get here, but put in a dummy case to satisfy the compiler */
return LIBX52_ERROR_INVALID_PARAM;
}
uint16_t h24 = !!(x52->time_format[clock]);
h24 = !!(x52->time_format[clock]);
if (clock != LIBX52_CLOCK_1) {
value = libx52_calculate_clock_offset(x52, clock, h24);

View File

@ -32,6 +32,8 @@ static int libx52_check_product(uint16_t idVendor, uint16_t idProduct)
case X52_PROD_X52_2:
case X52_PROD_X52PRO:
return 1;
default:
return 0;
}
}
@ -190,6 +192,8 @@ int libx52_check_feature(libx52_device *dev, libx52_feature feature)
return tst_bit(&(dev->flags), X52_FLAG_IS_PRO) ?
LIBX52_SUCCESS :
LIBX52_ERROR_NOT_SUPPORTED;
default:
return LIBX52_ERROR_INVALID_PARAM;
}
return LIBX52_ERROR_INVALID_PARAM;

View File

@ -168,8 +168,11 @@ int libx52_set_clock_timezone(libx52_device *x52, libx52_clock_id clock, int off
set_bit(&x52->update_mask, X52_BIT_MFD_OFFS2);
break;
default:
case LIBX52_CLOCK_1:
return LIBX52_ERROR_NOT_SUPPORTED;
default:
return LIBX52_ERROR_INVALID_PARAM;
}
return LIBX52_SUCCESS;

View File

@ -58,7 +58,15 @@ static int x52pro_set_led_state(libx52_device *x52, libx52_led_id led, libx52_le
}
break;
default:
case LIBX52_LED_A:
case LIBX52_LED_B:
case LIBX52_LED_D:
case LIBX52_LED_E:
case LIBX52_LED_T1:
case LIBX52_LED_T2:
case LIBX52_LED_T3:
case LIBX52_LED_POV:
case LIBX52_LED_CLUTCH:
/* All other LEDs support OFF, RED, AMBER and GREEN states
* However, they are composed of individual RED and GREEN LEDs which
* must be turned on or off individually.
@ -84,15 +92,23 @@ static int x52pro_set_led_state(libx52_device *x52, libx52_led_id led, libx52_le
set_bit(&x52->led_mask, led + 1); // Green
break;
default:
case LIBX52_LED_STATE_ON:
/* Cannot set the LED to "ON" */
return LIBX52_ERROR_NOT_SUPPORTED;
default:
/* Any other state is not valid */
return LIBX52_ERROR_INVALID_PARAM;
}
/* Set the update mask bits */
set_bit(&x52->update_mask, led + 0); // Red
set_bit(&x52->update_mask, led + 1); // Green
break;
default:
/* Any other LED is not valid */
return LIBX52_ERROR_INVALID_PARAM;
}
return LIBX52_SUCCESS;