summaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/eeepc-laptop.c
diff options
context:
space:
mode:
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>2009-12-03 08:44:59 +0100
committerLen Brown <len.brown@intel.com>2009-12-09 21:54:31 +0100
commit13f70029daa3cd7f9983e4aec82f32939b1a6e6a (patch)
treea4e2e628f67efcaba1b1da1af274231425c75455 /drivers/platform/x86/eeepc-laptop.c
parenteeepc-laptop: fix potential leak (led_init() failure) (diff)
downloadlinux-13f70029daa3cd7f9983e4aec82f32939b1a6e6a.tar.xz
linux-13f70029daa3cd7f9983e4aec82f32939b1a6e6a.zip
eeepc-laptop: fix set_acpi() to return non-zero on failure
If the control method does not exist, return -ENODEV for consistency with get_acpi() Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform/x86/eeepc-laptop.c')
-rw-r--r--drivers/platform/x86/eeepc-laptop.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 8b686b563ec0..abd7389a4493 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -289,26 +289,30 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val)
static int set_acpi(int cm, int value)
{
- if (ehotk->cm_supported & (0x1 << cm)) {
- const char *method = cm_setv[cm];
- if (method == NULL)
- return -ENODEV;
- if (write_acpi_int(ehotk->handle, method, value, NULL))
- pr_warning("Error writing %s\n", method);
- }
+ const char *method = cm_setv[cm];
+
+ if (method == NULL)
+ return -ENODEV;
+ if ((ehotk->cm_supported & (0x1 << cm)) == 0)
+ return -ENODEV;
+
+ if (write_acpi_int(ehotk->handle, method, value, NULL))
+ pr_warning("Error writing %s\n", method);
return 0;
}
static int get_acpi(int cm)
{
- int value = -ENODEV;
- if ((ehotk->cm_supported & (0x1 << cm))) {
- const char *method = cm_getv[cm];
- if (method == NULL)
- return -ENODEV;
- if (read_acpi_int(ehotk->handle, method, &value))
- pr_warning("Error reading %s\n", method);
- }
+ const char *method = cm_getv[cm];
+ int value;
+
+ if (method == NULL)
+ return -ENODEV;
+ if ((ehotk->cm_supported & (0x1 << cm)) == 0)
+ return -ENODEV;
+
+ if (read_acpi_int(ehotk->handle, method, &value))
+ pr_warning("Error reading %s\n", method);
return value;
}