SNC handles are positive numbers, all handles are valid with the sole exception of handle 0x0. This patch replaces int type with unsigned int when dealing with handles while sony_find_snc_handle now returns -1 when its value is 0x0. Signed-off-by: Marco Chiappero <marco@xxxxxxxxxx> --- --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c @@ -150,7 +150,7 @@ enum sony_nc_rfkill { N_SONY_RFKILL, }; -static int sony_rfkill_handle; +static unsigned int sony_rfkill_handle; static struct rfkill *sony_rfkill_devices[N_SONY_RFKILL]; static int sony_rfkill_address[N_SONY_RFKILL] = {0x300, 0x500, 0x700, 0x900}; static void sony_nc_rfkill_update(void); @@ -811,12 +811,12 @@ static int sony_nc_handles_cleanup(struc return 0; } -static int sony_find_snc_handle(int handle) +static int sony_find_snc_handle(unsigned int handle) { int i; - /* not initialized yet, return early */ - if (!handles) + /* not initialized yet or invalid handle, return early */ + if (!handles || !handle) return -1; for (i = 0; i < 0x10; i++) { @@ -830,7 +830,7 @@ static int sony_find_snc_handle(int hand return -1; } -static int sony_call_snc_handle(int handle, int argument, int *result) +static int sony_call_snc_handle(unsigned int handle, int argument, int *result) { int ret = 0; int offset = sony_find_snc_handle(handle); @@ -937,7 +937,7 @@ static ssize_t sony_nc_sysfs_store(struc */ struct sony_backlight_props { struct backlight_device *dev; - int handle; + unsigned int handle; u8 offset; u8 maxlvl; }; @@ -1557,7 +1557,7 @@ static void sony_nc_kbd_backlight_resume &ignore); } -static void sony_nc_backlight_ng_read_limits(int handle, +static void sony_nc_backlight_ng_read_limits(unsigned int handle, struct sony_backlight_props *props) { int offset; -- To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html