platform/x86: dell-laptop: Refactor kbd_led_triggers_store()
Return -EINVAL immediately on invalid input, rather then doing the straight path in an if block and returning -EINVAL at the end of the function. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
This commit is contained in:
parent
504b02593f
commit
1c7e28246e
1 changed files with 32 additions and 31 deletions
|
@ -1666,15 +1666,19 @@ static ssize_t kbd_led_triggers_store(struct device *dev,
|
|||
}
|
||||
}
|
||||
|
||||
if (trigger_bit != -1) {
|
||||
if (trigger_bit == -1)
|
||||
return -EINVAL;
|
||||
|
||||
new_state = state;
|
||||
if (trigger[0] == '+')
|
||||
new_state.triggers |= BIT(trigger_bit);
|
||||
else {
|
||||
new_state.triggers &= ~BIT(trigger_bit);
|
||||
/* NOTE: trackstick bit (2) must be disabled when
|
||||
/*
|
||||
* NOTE: trackstick bit (2) must be disabled when
|
||||
* disabling touchpad bit (1), otherwise touchpad
|
||||
* bit (1) will not be disabled */
|
||||
* bit (1) will not be disabled
|
||||
*/
|
||||
if (trigger_bit == 1)
|
||||
new_state.triggers &= ~BIT(2);
|
||||
}
|
||||
|
@ -1697,9 +1701,6 @@ static ssize_t kbd_led_triggers_store(struct device *dev,
|
|||
return count;
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static ssize_t kbd_led_triggers_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue