aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnssi Hannula <anssi.hannula@iki.fi>2011-02-20 13:07:20 -0500
committerMatthew Garrett <mjg@redhat.com>2011-03-28 06:07:17 -0400
commit9af0e0fb70ed8e2387323c19496a7e174363f7b6 (patch)
tree637c967dbb194e1e8aed4177ef9bf03eb6c2ff30
parent7751ab8e600f26e10c2ba12a92d48a4852a51da8 (diff)
hp-wmi: check query return value in hp_wmi_perform_query
Check BIOS provided return value code in hp_wmi_perform_query and print a warning on error. Printing is suppressed for HPWMI_RET_UNKNOWN_CMDTYPE which is returned when the command type is unsupported. Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi> Signed-off-by: Matthew Garrett <mjg@redhat.com>
-rw-r--r--drivers/platform/x86/hp-wmi.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 9e05af9c41cb..87dfb2489762 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -89,6 +89,13 @@ struct bios_return {
89 u32 value; 89 u32 value;
90}; 90};
91 91
92enum hp_return_value {
93 HPWMI_RET_WRONG_SIGNATURE = 0x02,
94 HPWMI_RET_UNKNOWN_COMMAND = 0x03,
95 HPWMI_RET_UNKNOWN_CMDTYPE = 0x04,
96 HPWMI_RET_INVALID_PARAMETERS = 0x05,
97};
98
92static const struct key_entry hp_wmi_keymap[] = { 99static const struct key_entry hp_wmi_keymap[] = {
93 { KE_KEY, 0x02, { KEY_BRIGHTNESSUP } }, 100 { KE_KEY, 0x02, { KEY_BRIGHTNESSUP } },
94 { KE_KEY, 0x03, { KEY_BRIGHTNESSDOWN } }, 101 { KE_KEY, 0x03, { KEY_BRIGHTNESSDOWN } },
@@ -171,6 +178,15 @@ static int hp_wmi_perform_query(int query, int write, u32 *buffer,
171 178
172 bios_return = *((struct bios_return *)obj->buffer.pointer); 179 bios_return = *((struct bios_return *)obj->buffer.pointer);
173 180
181 if (bios_return.return_code) {
182 if (bios_return.return_code != HPWMI_RET_UNKNOWN_CMDTYPE)
183 printk(KERN_WARNING PREFIX "query 0x%x returned "
184 "error 0x%x\n",
185 query, bios_return.return_code);
186 kfree(obj);
187 return bios_return.return_code;
188 }
189
174 memcpy(buffer, &bios_return.value, sizeof(bios_return.value)); 190 memcpy(buffer, &bios_return.value, sizeof(bios_return.value));
175 191
176 kfree(obj); 192 kfree(obj);