From patchwork Tue Jun 16 15:35:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 224444 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3899EC433DF for ; Tue, 16 Jun 2020 15:57:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1198B21534 for ; Tue, 16 Jun 2020 15:57:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592323025; bh=FFSxGwBGfMCiFQduasCBES4XmyOFzA/eJW0MOePvNZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=kIro8krq89vZqhf/ux49vShtOrvIlikpkTTJIF75DHIHuUOXglNSuCSeSqi4JREdG 5Nd6TcZrtXeY5L7VCUQNyYm3sAgo2CLZqRJpScdtwdoL+dKfIi/Emq45JfrK/+KnZj 8reugAhVWwxAC6sNcdMYQYFXJrhor3CHWFSGG24w= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733091AbgFPPzf (ORCPT ); Tue, 16 Jun 2020 11:55:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:55796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733085AbgFPPzf (ORCPT ); Tue, 16 Jun 2020 11:55:35 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 89299207C4; Tue, 16 Jun 2020 15:55:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592322935; bh=FFSxGwBGfMCiFQduasCBES4XmyOFzA/eJW0MOePvNZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uXuw0ArzZtGVjpgat6pkWKzJoWO3bHbaIQjKnOXducIVV51QMHNisRxU9tl9ezVK0 AyOtrYztgrT9znONp4MvTsV/7F572lc3T9P00A2h0RZ/9gGq8B6gqiB5oQVTdVQQDt SoBHsBtQgarxvk1MznOluPZFL4sKavuzL89sYaYI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dominik Mierzejewski , Mattia Dongili , Andy Shevchenko Subject: [PATCH 5.6 159/161] platform/x86: sony-laptop: Make resuming thermal profile safer Date: Tue, 16 Jun 2020 17:35:49 +0200 Message-Id: <20200616153113.952867377@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200616153106.402291280@linuxfoundation.org> References: <20200616153106.402291280@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mattia Dongili 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 --- drivers/platform/x86/sony-laptop.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c @@ -2288,7 +2288,12 @@ static void sony_nc_thermal_cleanup(stru #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);