Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp119464ybg; Mon, 8 Jun 2020 18:09:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWzUKSy1/JhvDTmnteeGL0J2Y0JJsMQ8Vhb4EKY8oVQmk+uwvdzJLtvd2fO7vrf8hhF61Q X-Received: by 2002:a17:907:35c2:: with SMTP id ap2mr7331047ejc.530.1591664956359; Mon, 08 Jun 2020 18:09:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591664956; cv=none; d=google.com; s=arc-20160816; b=XQadrYFVPnfqR47CXxYN+W1mRKC/uGpeTdwLsEXMIDsLmxW579CnJOnrA8BIbavtE6 EOQGEL40gjk87oVyAIfey7nbtcNF9iYeOJ+onGpJtjK0HOnH67b/weRco9t2llrRqGm1 NkUKHSuWgE/vDfPmfdk3SKnUo7EtQZi/Fn58lRIvumuI29bygpPgveevcPXO2dgK+XGr 8eH7WigL7Ifi5Z83Q8pcUcQzgCn//ZTjyKeqbqH094xB7PWoegeDO9XXaGhq1sAkeXjP CIQnnqChGnc6wVjRw+4gl91YqcJlMi6Q1fNjTT5zl+GuLpqnZ1OfwrFYTg0yTJD9QBjs Ejjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gQ8GRvIR5H+u0FY3UZR6/mxEm3nrwO7N15BtL20/hBM=; b=G+h3AdNO/EZbOQDnLb/SCMEF26sVM+AdHCH3PMYuCQVGj94Cy/JPfrhjkjnmbXCTL5 /mxp6BwwsvgEyfPomsQyY7qW2v5M9ePKWmPWsHqa0Z4VQ7HZct6ZLlX/ElUOe7bHDpP7 iqJuIeg4S/9kf7t7TlCvi8reRsYQ1OH2SdvbatSgpqvsnA3I0YPiprUHRgAB1HsMeX69 q5jv4FzmY8Zzl/dxKyVmysVVX9mSYN90gjqmGvmmUE/zVm9gYZwXX9HkGgXn2dd+6vEW 1lkEq2J69hCtE83bAWbikgAU6kfxFgSawWfHR7G/nFU4eOEVPAvwpVjvUSigMDLDgkb7 Opdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vJcM0gWs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v6si10049140edj.537.2020.06.08.18.08.53; Mon, 08 Jun 2020 18:09:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vJcM0gWs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727788AbgFIBHO (ORCPT + 99 others); Mon, 8 Jun 2020 21:07:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:50676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727773AbgFHXHC (ORCPT ); Mon, 8 Jun 2020 19:07:02 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ACE4B20820; Mon, 8 Jun 2020 23:07:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657622; bh=Ye++hxdlWa+ti5cA5JE7quOuxtmeHQDjYv35mFH/6fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vJcM0gWsbh/IilrRp8zLxTn1fhb8G6TK8fv18c/cI38d7I0SaZGIPaXfRJY/NtYpc w4QG9+YgnOzvbQJWsQVpWK7To0iyNjGi7pvRbwUtu2jJff6mQqHD2lsf3O5YftX3c4 cxD7hjC2A5gKhOm4e7LSamjThk/tH8e4LKM23n/8= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mattia Dongili , Dominik Mierzejewski , Andy Shevchenko , Sasha Levin , platform-driver-x86@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 043/274] platform/x86: sony-laptop: Make resuming thermal profile safer Date: Mon, 8 Jun 2020 19:02:16 -0400 Message-Id: <20200608230607.3361041-43-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mattia Dongili [ Upstream commit 476d60b1b4c8a2b14a53ef9b772058f35e604661 ] 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: Sasha Levin --- drivers/platform/x86/sony-laptop.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 51309f7ceede..e4ef3dc3bc2f 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c @@ -2295,7 +2295,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); -- 2.25.1