From: Lee, Chun-Yi <[email protected]>

commit f24c96eae58aeea4c36fb064cf3ee9734933f8fc upstream.

Fengguang Wu run kernel build test to platform-drivers-x86/linux-next git tree
on x86_64 architecture and found a warning that was introduced by
727651bf738b6b917335025d09323d0962eda114 commit:

drivers/platform/x86/acer-wmi.c: In function ‘WMID_set_capabilities‘:
drivers/platform/x86/acer-wmi.c:1211: warning: ‘devices‘ may be used
uninitialized in this function

This patch fixes the above warning message.

Cc: Carlos Corbacho <[email protected]>
Cc: Matthew Garrett <[email protected]>
Cc: Dmitry Torokhov <[email protected]>
Cc: Corentin Chary <[email protected]>
Cc: Fengguang Wu <[email protected]>
Signed-off-by: Lee, Chun-Yi <[email protected]>
Signed-off-by: Matthew Garrett <[email protected]>
Signed-off-by: Paul Bolle <[email protected]>
---
0) Compile tested only.

1) The platform-drivers-x86/linux-next commit referenced above is, as
far as I can tell, upstream commit
f20aaba9819d0801fb1314363f97239da0100bac ("acer-wmi: fix obj is NULL but
dereferenced").

2) Please note that this patch doesn't just avoid a warning. It ensures
'devices' will be initialized before use. That was actually the point of
this patch.

 drivers/platform/x86/acer-wmi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index afed701..684ce75 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -1204,6 +1204,9 @@ static acpi_status WMID_set_capabilities(void)
                        devices = *((u32 *) obj->buffer.pointer);
                } else if (obj->type == ACPI_TYPE_INTEGER) {
                        devices = (u32) obj->integer.value;
+               } else {
+                       kfree(out.pointer);
+                       return AE_ERROR;
                }
        } else {
                kfree(out.pointer);
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to