From: Mattia Dongili Date: Fri, 8 May 2020 00:14:05 +0000 (+0900) Subject: platform/x86: sony-laptop: Make resuming thermal profile safer X-Git-Tag: v5.6.19~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a688d4d5ba1d15ed28e462e33a2c616420150198;p=thirdparty%2Fkernel%2Fstable.git platform/x86: sony-laptop: Make resuming thermal profile safer commit 476d60b1b4c8a2b14a53ef9b772058f35e604661 upstream. The thermal handle object may fail initialization when the module is loaded in the first place. Avoid attempting to use it on resume then. Fixes: 6d232b29cfce ("ACPICA: Dispatcher: always generate buffer objects for ASL create_field() operator") Reported-by: Dominik Mierzejewski Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=207491 Signed-off-by: Mattia Dongili Signed-off-by: Andy Shevchenko Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 88faad521e073..32fa60feaadbc 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c @@ -2288,7 +2288,12 @@ static void sony_nc_thermal_cleanup(struct platform_device *pd) #ifdef CONFIG_PM_SLEEP static void sony_nc_thermal_resume(void) { - unsigned int status = sony_nc_thermal_mode_get(); + int status; + + if (!th_handle) + return; + + status = sony_nc_thermal_mode_get(); if (status != th_handle->mode) sony_nc_thermal_mode_set(th_handle->mode);