]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/platform-x86-sony-laptop-fix-unintentional-fall-through.patch
4.4-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.4 / platform-x86-sony-laptop-fix-unintentional-fall-through.patch
1 From 1cbd7a64959d33e7a2a1fa2bf36a62b350a9fcbd Mon Sep 17 00:00:00 2001
2 From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
3 Date: Wed, 24 Apr 2019 13:09:34 -0500
4 Subject: platform/x86: sony-laptop: Fix unintentional fall-through
5
6 From: Gustavo A. R. Silva <gustavo@embeddedor.com>
7
8 commit 1cbd7a64959d33e7a2a1fa2bf36a62b350a9fcbd upstream.
9
10 It seems that the default case should return AE_CTRL_TERMINATE, instead
11 of falling through to case ACPI_RESOURCE_TYPE_END_TAG and returning AE_OK;
12 otherwise the line of code at the end of the function is unreachable and
13 makes no sense:
14
15 return AE_CTRL_TERMINATE;
16
17 This fix is based on the following thread of discussion:
18
19 https://lore.kernel.org/patchwork/patch/959782/
20
21 Fixes: 33a04454527e ("sony-laptop: Add SNY6001 device handling (sonypi reimplementation)")
22 Cc: stable@vger.kernel.org
23 Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
24 Reviewed-by: Kees Cook <keescook@chromium.org>
25 Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
26 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27
28 ---
29 drivers/platform/x86/sony-laptop.c | 8 +++++---
30 1 file changed, 5 insertions(+), 3 deletions(-)
31
32 --- a/drivers/platform/x86/sony-laptop.c
33 +++ b/drivers/platform/x86/sony-laptop.c
34 @@ -4394,14 +4394,16 @@ sony_pic_read_possible_resource(struct a
35 }
36 return AE_OK;
37 }
38 +
39 + case ACPI_RESOURCE_TYPE_END_TAG:
40 + return AE_OK;
41 +
42 default:
43 dprintk("Resource %d isn't an IRQ nor an IO port\n",
44 resource->type);
45 + return AE_CTRL_TERMINATE;
46
47 - case ACPI_RESOURCE_TYPE_END_TAG:
48 - return AE_OK;
49 }
50 - return AE_CTRL_TERMINATE;
51 }
52
53 static int sony_pic_possible_resources(struct acpi_device *device)