Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3628670pxb; Mon, 24 Jan 2022 13:54:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJyrdrQR8UEtuKdIFD8VqjM/fzl5T2fjwW7FXDo62XmXDMSsa3b9QpaIyxQb61CqJyhR8GKZ X-Received: by 2002:a05:6a00:1681:b0:4a8:2462:ba0a with SMTP id k1-20020a056a00168100b004a82462ba0amr15589056pfc.75.1643061275553; Mon, 24 Jan 2022 13:54:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643061275; cv=none; d=google.com; s=arc-20160816; b=y07y0zDKJF4OZZBuCsxMaUxrT4epFBcaCqOwKKoGcUrNRu13TX6oaaq1x8YbHdWWN1 LTZL+xmA4rc3VjviVtA9ykcipFJqSP4kNF8fuTS8J7Ue03dJJ5l8CfWVl9sFmBudkGiq Rep7gJ89d0jG22vtDn712B3Bvua1ZV154P2xkT12C3cAmBV+uXXWii6XLLgfWtMe94Fe 6U7RuNFfVEo3mNCMFskoIb7rqGkcapyeVAzE1NKEoCSAaybZlcbd4c8wuDxXQqxtz5iq yHMWeC2GjxLSHMEMUdDJOTyvC7UlvuEkOO2aLuJQ/CV3yTj4jZzT/CfqlrZ0VBPyz1NU Om+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=B6O+uHRwgkBKs83klDd1/bZ7rtfcQeN7TaeUU9q2xoU=; b=A66AJeyunJbrh8eqHBH9iSxHbHE3cZW2KommOF79OaoRZ2Wx/iozNQaGcSAfJWteD2 zerP6oFTHnSLYvsjXk8AUCKycC/RPhCMiO1G13JM7y0WY2iqURR+N9ticEljeI9mk8TB 1DENFAV2JijfwDNclo7OgJB7YiMeRoAj2L1mc2VTkYVY4zgTk4f0emBFgD8HfDO0MdEZ WfFFPvYDoVxCJmEUhNXNhpGVN6OlZGrX8j810FbTHHvYr1mKzYKV6on1iT/h1VwKtWT+ 8YL9DbOxXIMdvi0fmN6jjh2J2lwwr/arGrhZYtpX0qVVEvCnuj9KfFJO+6+njhOLJYqy Ltow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="D02rKWm/"; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m19si414275pjl.114.2022.01.24.13.54.20; Mon, 24 Jan 2022 13:54:35 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b="D02rKWm/"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457746AbiAXVmO (ORCPT + 99 others); Mon, 24 Jan 2022 16:42:14 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58320 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354151AbiAXVFt (ORCPT ); Mon, 24 Jan 2022 16:05:49 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0B5F8B811FB; Mon, 24 Jan 2022 21:05:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 535D3C340E5; Mon, 24 Jan 2022 21:05:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058345; bh=X6EgPPABSu9qIS8VsK+/BZjQrgBbZL9LjiIth+gV+38=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D02rKWm/L+Nbuqn1eioq6F07MTd1pOyGPCoHKHPjHeuvgDIdCBEveGDmQCP9Cz80d G9C/kUn925Ii7ujc+yBqc8NRthdYDgRFfXY0E9hzYSmMFFLjeKO12zBDhaS5fbj/7F /Zd19ikI7/bEEyDHbE6K1WchiV8bUQdH2IZXOzXU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Dan Carpenter , Rodrigo Siqueira , Pavle Kotarac , Wayne Lin , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0258/1039] drm/amd/display: Fix bug in debugfs crc_win_update entry Date: Mon, 24 Jan 2022 19:34:07 +0100 Message-Id: <20220124184133.986450956@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wayne Lin [ Upstream commit 4bef85d4c9491415b7931407b07f24841c1e0390 ] [Why] crc_rd_wrk shouldn't be null in crc_win_update_set(). Current programming logic is inconsistent in crc_win_update_set(). [How] Initially, return if crc_rd_wrk is NULL. Later on, we can use member of crc_rd_wrk safely. Reported-by: kernel test robot Reported-by: Dan Carpenter Fixes: 9a65df193108 ("drm/amd/display: Use PSP TA to read out crc") Reviewed-by: Rodrigo Siqueira Acked-by: Pavle Kotarac Signed-off-by: Wayne Lin Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c index 9d43ecb1f692d..f4e829ec8e108 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c @@ -2909,10 +2909,13 @@ static int crc_win_update_set(void *data, u64 val) struct amdgpu_device *adev = drm_to_adev(new_crtc->dev); struct crc_rd_work *crc_rd_wrk = adev->dm.crc_rd_wrk; + if (!crc_rd_wrk) + return 0; + if (val) { spin_lock_irq(&adev_to_drm(adev)->event_lock); spin_lock_irq(&crc_rd_wrk->crc_rd_work_lock); - if (crc_rd_wrk && crc_rd_wrk->crtc) { + if (crc_rd_wrk->crtc) { old_crtc = crc_rd_wrk->crtc; old_acrtc = to_amdgpu_crtc(old_crtc); } -- 2.34.1