Revert "platform/x86/toshiba-apci.c possible bad if test?"
Subsystems (2)
PATCH 1/1 Revert "platform/x86/toshiba-apci.c possible bad if test?"
From: Ari Sundholm <[email protected]>
This reverts commit bdc3ae7221213963f438faeaa69c8b4a2195f491.
--- drivers/platform/x86/toshiba_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/toshiba_acpi.c +1 -1
@@ -1258,7 +1258,7 @@ static ssize_t toshiba_kbd_bl_mode_store(struct device *dev,int mode =-1 ;int time =-1 ; -if (sscanf (buf,"%i" , &mode) !=1 || (mode !=2 || mode !=1 )) +if (sscanf (buf,"%i" , &mode) !=1 && (mode !=2 || mode !=1 ))return -EINVAL ;/* Set the Keyboard Backlight Mode where:
Signature · 1 line
1.9.1
drivers/platform/x86/toshiba_acpi.c static ssize_t toshiba_kbd_bl_mode_store(struct device *dev, · line 1262
Quoted 6 lines · Ari Sundholm
From: Ari Sundholm <[email protected]>
This reverts commit
bdc3ae7221213963f438faeaa69c8b4a2195f491.drivers/platform/x86/toshiba_acpi.c +1
-0+if (sscanf (buf,"%i" , &mode) !=1 && (mode !=2 || mode !=1 ))return -EINVAL ;
I'm not convinced that's right either. If we come in and mode == 1, then the mode != 2 is true, and yoinks...
I think this wanted to be sscanf() != 1 || ! (mode == 2 || mode == 1)
I'll spin a patch against the reverted version if desired.
drivers/platform/x86/toshiba_acpi.c static ssize_t toshiba_kbd_bl_mode_store(struct device *dev, · line 1262
Quoted 3 lines · Ari Sundholm
drivers/platform/x86/toshiba_acpi.c +1
-1-if (sscanf (buf,"%i" , &mode) !=1 || (mode !=2 || mode !=1 )) +if (sscanf (buf,"%i" , &mode) !=1 && (mode !=2 || mode !=1 ))return -EINVAL ;
Note that the condition still looks wrong even after the revert, as (mode != 2 || mode != 1) is always true. Anybody guess what the actual intent was?
Best regards,
Ari Sundholm
[email protected]