From patchwork Tue Sep 26 05:56:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Liu X-Patchwork-Id: 144732 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1695822vqu; Mon, 25 Sep 2023 23:00:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGEfiRAZwXGjbftIA53sY0soLLy0saS1btdDfNvJPQOJfv9Eh0zs50zF89epbUjr4sl79tR X-Received: by 2002:a05:6a20:101a:b0:14c:4deb:3dc4 with SMTP id gs26-20020a056a20101a00b0014c4deb3dc4mr8299604pzc.31.1695708017335; Mon, 25 Sep 2023 23:00:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695708017; cv=none; d=google.com; s=arc-20160816; b=g5NXap0h6LOFkPok2GZ2ykGFO9z0QoNZWeW6AtR/C1CbR0NVWYF6/aak1n5uJB7+N4 at04GL2/Le1hS7W1sd2YCq36hUFV8saSN92eNYcxccSTaB7FxFtnEXJdRgpWIQDgXOUf 5PvKVPTufwmLPhl8ge+sC72MRGPQbN4q5i3F6r9divXhaykZh1F6PSA0xb6R/qwU2LcQ MZCFjvVMz76Z2C5s0WavjsL6UiNFwyVpmmSgX0kMtj6iGNF5zj/35UNTYcymrdC+tlJF KRbOPLJKm4hRRmIgGxIzwq8KeHcacDX8oeFhe3LKyEYBgODlA7cqlKvzdOjfi/uGck6+ NvsA== 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 :message-id:date:subject:cc:to:from; bh=1nFLTXHceDFowM97RDTgoUvFaY5dCPOGFEwf/4IJ540=; fh=0QQLjqh88xLC7/w3eBA7W8xxPTWF4qtbLmiYGDQcJtA=; b=cEc4gBQ36lern4sogB4HRHXsH5PdV3x3jBoInLar332paliRYcGkmvAhuSL5j0+crC 6p6l91PMOJUMLxuJPo15tV4PBAcwOkxwCQTpM71ztWRWnXIlHoAkzkUBXTRdKY8v5W4I gcEDUfSvSgupmaCu+QVzQbrx7miB4BVYldqZ4UyIl5VcJ2EAyYOgx2OknJu8PUjA59xF 4OVv1QZ2rz24FYhHYLl5Fa8mxji3su6qaTg8RDNC2uZkg7oaxbEKKLsPgjb5dKqaqWlB 6Pep0+epnRjp4iuvdNXd20CBFGkf+2mr2ADwZfR5HGqdVcui+/qX8i4kjWHv4Cnycjgi vOvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id m11-20020a170902c44b00b001c6183af4d3si4344288plm.332.2023.09.25.23.00.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 23:00:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id B180280BB5DB; Mon, 25 Sep 2023 22:58:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233689AbjIZF5q (ORCPT + 26 others); Tue, 26 Sep 2023 01:57:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231466AbjIZF5n (ORCPT ); Tue, 26 Sep 2023 01:57:43 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1F389D for ; Mon, 25 Sep 2023 22:57:36 -0700 (PDT) X-UUID: 3c5ed56bf6c94e699b45d29275fdf15f-20230926 X-CID-O-RULE: Release_Ham X-CID-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.31,REQID:62cae887-a010-406f-b0cb-62e849e7dd42,IP:5,U RL:0,TC:0,Content:0,EDM:25,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:15 X-CID-INFO: VERSION:1.1.31,REQID:62cae887-a010-406f-b0cb-62e849e7dd42,IP:5,URL :0,TC:0,Content:0,EDM:25,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:15 X-CID-META: VersionHash:0ad78a4,CLOUDID:ed0b47bf-14cc-44ca-b657-2d2783296e72,B ulkID:230926135702CTO4OX2J,BulkQuantity:0,Recheck:0,SF:24|17|19|44|38|102, TC:nil,Content:0,EDM:5,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0, OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI X-UUID: 3c5ed56bf6c94e699b45d29275fdf15f-20230926 X-User: liucong2@kylinos.cn Received: from localhost.localdomain [(116.128.244.169)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1803900476; Tue, 26 Sep 2023 13:57:02 +0800 From: Cong Liu To: Evan Quan , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter Cc: Cong Liu , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] drm/amd/pm: Fix warn: missing error code in smu_v13_0_0_check_ecc_table_support() Date: Tue, 26 Sep 2023 13:56:59 +0800 Message-Id: <20230926055700.119576-1-liucong2@kylinos.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 25 Sep 2023 22:58:09 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778078729910336471 X-GMAIL-MSGID: 1778078729910336471 This patch fixes a smatch warning: drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_0_ppt.c:2868 smu_v13_0_0_check_ecc_table_support() warn: missing error code? 'ret' This warning is caused by the fact that this function returns the value of the variable ret. However, the value of ret is not explicitly set in the function. This patch fixes the warning by explicitly setting the value of ret to 0 if the device is supported Signed-off-by: Cong Liu --- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c index 9ac2be5627d9..cf832cef2b0a 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c @@ -2863,11 +2863,11 @@ static int smu_v13_0_0_check_ecc_table_support(struct smu_context *smu) if (ret) return -EOPNOTSUPP; - if ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 10)) && - (smu_version >= SUPPORT_ECCTABLE_SMU_13_0_10_VERSION)) - return ret; - else + if ((adev->ip_versions[MP1_HWIP][0] != IP_VERSION(13, 0, 10)) && + (smu_version < SUPPORT_ECCTABLE_SMU_13_0_10_VERSION)) return -EOPNOTSUPP; + + return 0; } static ssize_t smu_v13_0_0_get_ecc_info(struct smu_context *smu, From patchwork Tue Sep 26 05:56:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Liu X-Patchwork-Id: 144735 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1698527vqu; Mon, 25 Sep 2023 23:05:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFSXyF/fEGI4YJc06oN75qFreMVRaWB3eRQs1eU4B1YGoCQNbySDcsc3C2BzYx8Xfsz8XHD X-Received: by 2002:a05:6a20:564d:b0:15d:c274:2eb1 with SMTP id is13-20020a056a20564d00b0015dc2742eb1mr6003489pzc.10.1695708304189; Mon, 25 Sep 2023 23:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695708304; cv=none; d=google.com; s=arc-20160816; b=vCc69HXLEyrunSLvJ/rHiT/e6nJREFnM+RDGpOIvumOl1Tz9MzHSrl7zRQLaiXh+OV y/pzNpcIzkGz2UWASQvjtWr14afsXSfK3fSzA315HpBJPso0RvdUF41a+D8FdHniDOGA rtMW+cTj2V02Rv9ivZ2Hk7XMsUO1o8/5SvSvqXDN1ZiKL2zt2W5fh7L6xRHhARIZtaQq 4p9oBsBcT8KVpWduV5FH8oJPjN9OkEuXEF6NMKtr1dkwoZ1XHZ+alQzXaGQqunibYHPD k+9RYxHwm8uIhKvsABnsM3IjICvRlcno9UodsoWKrAgpo63wjZpZK4n+BJjs5u7dHHPp LS2A== 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 :message-id:date:subject:cc:to:from; bh=xaLN3bUjJ2TfmzLNkr2YFYQFc55g8TAzz3ecOcckGQ4=; fh=Y4KPzTfXNHevA2GvFfn4pFCqxHZQYb62OXCfgRBC4fI=; b=GHp4r6hFwAr+Yb9kNfeKbX1cJ9lpNoWfzCfICjxNvdHFEO8pcwD3N9FNiauTBkBtpY udFea/SRoyOrPS3b2/oxWc3gVYv5MFuD0hK+sRGEhjuKYcTL/C3H+9e3TU2XF24eoEft Hst20Q2VUu2NvFGTcwNJ7UTyd7usG/0Jw2ApQG6x01PMo051sLXPzfN84ZFXveRkhPUl ku5c9K/JZ9qmWWjqfQpI9gdROR4cGB7y0TP6qIB73xNq5Og//7TpbD9m38Z1QcXKCf40 +2K3K/+og17AOSmEtu2cdlEqnBh6NELMKHJaUyJb/LRBRoY110ul5tf+LskUIjzLfXY/ 6qAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id cn12-20020a056a020a8c00b00564a5b8937asi11295455pgb.341.2023.09.25.23.05.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 23:05:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id E015280A1E31; Mon, 25 Sep 2023 22:56:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233680AbjIZF4u (ORCPT + 26 others); Tue, 26 Sep 2023 01:56:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233689AbjIZF4r (ORCPT ); Tue, 26 Sep 2023 01:56:47 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FE1810A for ; Mon, 25 Sep 2023 22:56:40 -0700 (PDT) X-UUID: 48b130231b3f480fa2b389aa17cc4c13-20230926 X-CID-O-RULE: Release_Ham X-CID-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.31,REQID:274d52f7-406d-450b-9626-9226bea3d323,IP:5,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-10 X-CID-INFO: VERSION:1.1.31,REQID:274d52f7-406d-450b-9626-9226bea3d323,IP:5,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:-10 X-CID-META: VersionHash:0ad78a4,CLOUDID:710a47bf-14cc-44ca-b657-2d2783296e72,B ulkID:23092613562995M22TSX,BulkQuantity:0,Recheck:0,SF:19|44|38|24|17|102, TC:nil,Content:0,EDM:-3,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI X-UUID: 48b130231b3f480fa2b389aa17cc4c13-20230926 X-User: liucong2@kylinos.cn Received: from localhost.localdomain [(116.128.244.169)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 827163063; Tue, 26 Sep 2023 13:56:29 +0800 From: Cong Liu To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , Aurabindo Pillai , Tom Chung Cc: Cong Liu , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] drm/amd/display: Fix null pointer dereference in error message Date: Tue, 26 Sep 2023 13:56:17 +0800 Message-Id: <20230926055618.119195-1-liucong2@kylinos.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 25 Sep 2023 22:56:53 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778079030688115886 X-GMAIL-MSGID: 1778079030688115886 This patch fixes a null pointer dereference in the error message that is printed when the Display Core (DC) fails to initialize. The original message includes the DC version number, which is undefined if the DC is not initialized. Fixes: 9788d087caff ("drm/amd/display: improve the message printed when loading DC") Signed-off-by: Cong Liu Reviewed-by: Harry Wentland --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 8e98dda1e084..bf52a909f558 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1703,8 +1703,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) DRM_INFO("Display Core v%s initialized on %s\n", DC_VER, dce_version_to_string(adev->dm.dc->ctx->dce_version)); } else { - DRM_INFO("Display Core v%s failed to initialize on %s\n", DC_VER, - dce_version_to_string(adev->dm.dc->ctx->dce_version)); + DRM_INFO("Display Core failed to initialize with v%s!\n", DC_VER); goto error; }