[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    platform/x86: fujitsu-laptop: Don't oops when FUJ02E3 is not presnt
From:       "Linux Kernel Mailing List" <linux-kernel () vger ! kernel ! org>
Date:       2017-09-30 2:39:26
Message-ID: 20170930023926.2C93221B62 () pdx-korg-gitolite-1 ! ci ! codeaurora ! org
[Download RAW message or body]

Web:        https://git.kernel.org/torvalds/c/ce7c47d60bda6c7f09ccf16e978d971c8fa16ff0
Commit:     ce7c47d60bda6c7f09ccf16e978d971c8fa16ff0
Parent:     2bd6bf03f4c1c59381d62c61d03f6cc3fe71f66e
Refname:    refs/heads/master
Author:     Ville Syrjälä <ville.syrjala@linux.intel.com>
AuthorDate: Mon Sep 18 23:00:59 2017 +0300
Committer:  Darren Hart (VMware) <dvhart@infradead.org>
CommitDate: Wed Sep 27 00:04:43 2017 -0700

    platform/x86: fujitsu-laptop: Don't oops when FUJ02E3 is not presnt
    
    My Fujitsu-Siemens Lifebook S6120 doesn't have the FUJ02E3 device,
    but it does have FUJ02B1. That means we do register the backlight
    device (and it even seems to work), but the code will oops as soon
    as we try to set the backlight brightness because it's trying to
    call call_fext_func() with a NULL device. Let's just skip those
    function calls when the FUJ02E3 device is not present.
    
    Cc: Jonathan Woithe <jwoithe@just42.net>
    Cc: Andy Shevchenko <andy@infradead.org>
    Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Cc: <stable@vger.kernel.org> # 4.13.x
    Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
---
 drivers/platform/x86/fujitsu-laptop.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index 85de30f93a9c..56a8195096a2 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -254,10 +254,12 @@ static int bl_update_status(struct backlight_device *b)
 {
 	struct acpi_device *device = bl_get_data(b);
 
-	if (b->props.power == FB_BLANK_POWERDOWN)
-		call_fext_func(fext, FUNC_BACKLIGHT, 0x1, 0x4, 0x3);
-	else
-		call_fext_func(fext, FUNC_BACKLIGHT, 0x1, 0x4, 0x0);
+	if (fext) {
+		if (b->props.power == FB_BLANK_POWERDOWN)
+			call_fext_func(fext, FUNC_BACKLIGHT, 0x1, 0x4, 0x3);
+		else
+			call_fext_func(fext, FUNC_BACKLIGHT, 0x1, 0x4, 0x0);
+	}
 
 	return set_lcd_level(device, b->props.brightness);
 }
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic