platform/x86: sony-laptop: Make resuming thermal profile safer
authorMattia Dongili <malattia@linux.it>
Fri, 8 May 2020 00:14:05 +0000 (09:14 +0900)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 12 May 2020 14:27:11 +0000 (17:27 +0300)
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 <dominik@greysector.net>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=207491
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/platform/x86/sony-laptop.c

index 6932cd1..e5a1b55 100644 (file)
@@ -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);