diff options
author | Azael Avalos <coproscefalo@gmail.com> | 2014-09-10 23:01:57 -0400 |
---|---|---|
committer | Darren Hart <dvhart@linux.intel.com> | 2014-09-17 16:55:52 -0400 |
commit | c8a41669a76381f655f5567d3ccd8449a53f9a7f (patch) | |
tree | 04c6b1e25fd9fe673064397b4e8e09183dd0055a /drivers/platform/x86/toshiba_acpi.c | |
parent | 12962878fbf9578b3d30ee4d8a5cd6632f26324c (diff) |
toshiba_acpi: Change touchpad store to check for invalid values
The function toshiba_touchpad_store is not checking
for invalid values and simply returns silently.
This patch checks for invalid values and returns accordingly.
Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Diffstat (limited to 'drivers/platform/x86/toshiba_acpi.c')
-rw-r--r-- | drivers/platform/x86/toshiba_acpi.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 4c8fa7b72891..2a84652a4f0e 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -1343,12 +1343,18 @@ static ssize_t toshiba_touchpad_store(struct device *dev, | |||
1343 | { | 1343 | { |
1344 | struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev); | 1344 | struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev); |
1345 | int state; | 1345 | int state; |
1346 | int ret; | ||
1346 | 1347 | ||
1347 | /* Set the TouchPad on/off, 0 - Disable | 1 - Enable */ | 1348 | /* Set the TouchPad on/off, 0 - Disable | 1 - Enable */ |
1348 | if (sscanf(buf, "%i", &state) == 1 && (state == 0 || state == 1)) { | 1349 | ret = kstrtoint(buf, 0, &state); |
1349 | if (toshiba_touchpad_set(toshiba, state) < 0) | 1350 | if (ret) |
1350 | return -EIO; | 1351 | return ret; |
1351 | } | 1352 | if (state != 0 && state != 1) |
1353 | return -EINVAL; | ||
1354 | |||
1355 | ret = toshiba_touchpad_set(toshiba, state); | ||
1356 | if (ret) | ||
1357 | return ret; | ||
1352 | 1358 | ||
1353 | return count; | 1359 | return count; |
1354 | } | 1360 | } |