All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86: fujitsu-laptop: Don't oops when FUJ02E3 is not presnt
@ 2017-09-18 20:00 Ville Syrjala
  2017-09-19  4:06 ` Michał Kępień
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Ville Syrjala @ 2017-09-18 20:00 UTC (permalink / raw)
  To: platform-driver-x86
  Cc: Jonathan Woithe, Darren Hart, Andy Shevchenko,
	Ville Syrjälä

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

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: Darren Hart <dvhart@infradead.org>
Cc: Andy Shevchenko <andy@infradead.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 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);
 }
-- 
2.13.5

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2018-02-11 21:33 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-18 20:00 [PATCH] platform/x86: fujitsu-laptop: Don't oops when FUJ02E3 is not presnt Ville Syrjala
2017-09-19  4:06 ` Michał Kępień
2017-09-19  4:21   ` Jonathan Woithe
2017-09-19  4:42     ` Michał Kępień
2017-09-19  8:20       ` Jonathan Woithe
2017-09-19 13:25   ` Ville Syrjälä
2018-02-10 21:33   ` Michał Kępień
2017-09-23  0:00 ` Darren Hart
2017-09-23  2:03   ` Jonathan Woithe
2017-09-23  9:08   ` Jonathan Woithe
2017-09-25 12:14     ` Ville Syrjälä
2017-09-25 13:16       ` Jonathan Woithe
2017-09-26  4:49   ` Michał Kępień
2017-09-26  5:32     ` Jonathan Woithe
     [not found]     ` <20171018151058.GL10981@intel.com>
2017-10-20 17:29       ` Ville Syrjälä
2017-10-25  4:51       ` Michał Kępień
2017-10-25 10:05         ` Ville Syrjälä
2017-10-29 22:57         ` Jonathan Woithe
2018-02-11 21:33           ` Michał Kępień
2017-09-27  6:56 ` Darren Hart
2017-09-27  7:27   ` Jonathan Woithe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.