From patchwork Fri May 8 12:35:59 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: 226196 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, USER_AGENT_GIT autolearn=ham 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 0AEB4C38A2A for ; Fri, 8 May 2020 12:57:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D7E3C24958 for ; Fri, 8 May 2020 12:57:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588942627; bh=os/rM898h0GWxPAxlsSRkIi4ZajVCplOuaeMIrU9njg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=syyUvbvezgGf/76Og5cQGdN4+xDDUAW/kV3m71bwZ2T6OD37AquZvfPqvV3rzXeh6 /YEqeugOd9yOMWi8GALbTMPallDG8Pw57gG6R+LI5HNdGevgbOgQIbfh/lnQiA/Vha O6EG7/t0QiPMm2JNJ/6e1mHF1OtuIarwe0enQa5o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727889AbgEHM5G (ORCPT ); Fri, 8 May 2020 08:57:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:39200 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728482AbgEHMz5 (ORCPT ); Fri, 8 May 2020 08:55:57 -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 F21982054F; Fri, 8 May 2020 12:55:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588942557; bh=os/rM898h0GWxPAxlsSRkIi4ZajVCplOuaeMIrU9njg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lLdVzcbHvuW6M8ZiLCVN+LCXLgDhopTvTGdC91ivUijIocNZa82LsmF1382jeZSfe UmIzNPZosBCP8JEid+hhqRMUcUYJBwYqHI5okydvLSnzp9v0n4RoTlsf6FHxqqjh5p 1A2bP6I99B70fNJ3sw4yGaWxmi7Pz+sArD/a59x0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aaron Ma , Alex Deucher Subject: [PATCH 5.6 42/49] drm/amdgpu: Fix oops when pp_funcs is unset in ACPI event Date: Fri, 8 May 2020 14:35:59 +0200 Message-Id: <20200508123048.762117644@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200508123042.775047422@linuxfoundation.org> References: <20200508123042.775047422@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: Aaron Ma commit 5932d260a8d85a103bd6c504fbb85ff58b156bf9 upstream. On ARCTURUS and RENOIR, powerplay is not supported yet. When plug in or unplug power jack, ACPI event will issue. Then kernel NULL pointer BUG will be triggered. Check for NULL pointers before calling. Signed-off-by: Aaron Ma Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c @@ -91,7 +91,8 @@ void amdgpu_pm_acpi_event_handler(struct adev->pm.ac_power = true; else adev->pm.ac_power = false; - if (adev->powerplay.pp_funcs->enable_bapm) + if (adev->powerplay.pp_funcs && + adev->powerplay.pp_funcs->enable_bapm) amdgpu_dpm_enable_bapm(adev, adev->pm.ac_power); mutex_unlock(&adev->pm.mutex); }