From patchwork Thu Mar 9 21:30:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hamza Mahfooz X-Patchwork-Id: 67118 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp532587wrd; Thu, 9 Mar 2023 13:39:21 -0800 (PST) X-Google-Smtp-Source: AK7set/Sia9HGJAxeDfoxpgCLD4aEGEtgWP5aQ+bQobegd3tvyXryn2y9TCXRFzML+e+C9opvHWn X-Received: by 2002:a17:902:aa02:b0:19a:839d:b682 with SMTP id be2-20020a170902aa0200b0019a839db682mr21024908plb.17.1678397961161; Thu, 09 Mar 2023 13:39:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1678397961; cv=pass; d=google.com; s=arc-20160816; b=pZ4hj30kMtguDei1r+BqR8IPaXWWTXgA55uSNYzt8egCgLLcJMlpD2tHmkxhJW7t6B IWYYN4Vp3rlAdeOAGcgoGoGgB3Julm1nQcqYzZpL3rXVFKrhW2B5OiUGZnpdc770sW9P WRp+NjONe0ni3dFq8sGpFAuSnJuqxWsWKSB46J8tUhztMKQm/mBRolQMGweUjlU2bdLF VuhoSW9VcqbdZchzYnzgVHmz08SMUhJbV/vBdaVrG6a4XR5+4Vc9KOlwXy0AaLPNuqze 47jXv6OqyhIATZEBhJlVYTU8KYmtW4z+O7BipkcDgXd9Z+RZM6/KFHZgMq/FJsbZ+BNm G3GA== ARC-Message-Signature: i=2; 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:dkim-signature; bh=5+YA4NjhSP3EDqRuFPt4c+rAlvXC1z+sChnRzk1C8uA=; b=SvtJC6Xl+27kS4yj4SpTPVr8CZ95BDvyi3sXdmLeUEOVBHtMdVelHpY+o6e6xPGTyh 91U9Jr+/Vpwz2TzH5ApuRsSrerPZSi6K3U99dAiJTc57Cn3aeTyGNs2LowubiQbNv/nE ZowS1eWdqHivyY69Wfo1q5gyQlbqCc+x+EIxzceJv3AhaY7isvN27cJwlAwjJ6ygLmow BT7HnylZhoizkl3H095rsJYsUqv/kTYHcrfDuqu4imbOvPlYFwG66xHOSrHfkE/veJ+p Jo1noQTtDwpxNSnJ57YUwEDaZfMBWBugvZJrUhqRdUxBJeDSh8mlO7DoVP3i8PglCoBH qgdQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=RA8H+dgR; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ki3-20020a170903068300b0019928b97891si271074plb.436.2023.03.09.13.39.05; Thu, 09 Mar 2023 13:39:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=RA8H+dgR; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231417AbjCIVaW (ORCPT + 99 others); Thu, 9 Mar 2023 16:30:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231347AbjCIV36 (ORCPT ); Thu, 9 Mar 2023 16:29:58 -0500 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2061.outbound.protection.outlook.com [40.107.92.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F454E3491 for ; Thu, 9 Mar 2023 13:29:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YwC1bM2ICr2DXScuJKZ1RveLlZDQHGEOq+5e2Bc4iQXgitI9AVlpopJECiyrlVZAB6qTg7ZNJjqx6RNhy4lD28vW9se8r5/UQLl05ydvCyaswys9WcgKUc+XmOuFbrFcimdI9IQ4X+MX1Zu2FlMzZ7sfEz0BEIDoGYGj4vLxo3ZeJuGrikAgHUtLp5ORmJC5RxpLP7gDz82/hufAF7mk+mDFLcSfF8SZZyyKDsCCnMg7rR7fkxx2324jWwJzdpL/R/tnR1ejA59y/Jr56voqAmRcL63KXPH3Dh+c4rInBjAuzhlSaoTr691gnIhF5UcjZ669hkkCmJByk886x3k4tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5+YA4NjhSP3EDqRuFPt4c+rAlvXC1z+sChnRzk1C8uA=; b=UrfBBZnXQzgNoAFCFB6Gg0DjchvWJLP52XbXHRJJtRW0yNdKzDBEbAdJuThrPmw5sgReDde7qon5vqkneUci5WSaKGXzcQjinciScfoDmSDPqO6+oEkETcvLjYYaqhDX8Hrb7HI7GL8UBdHn57N1XQC6YQAdWmN/QtJjv4wxqdYriUIc8uHwI+2WYYrtFU983cbWJmujuwDt6FlmoLmE+80aQjpsmeMDUCPGt4LWvGEDEyak/YPA6uswO1seB9rd5TK9fjJ5mATooSKf9QtuNFvpbz8kulCQ9JAIF7alBaG0da9Dsu5FXIaaaPYVQuI9WP1hueUsb9Bx7E2l/whtKA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5+YA4NjhSP3EDqRuFPt4c+rAlvXC1z+sChnRzk1C8uA=; b=RA8H+dgRBFyyIUwft8FQfyb0ZYeDh/dx2ky60svDzkuYAzajjFDPvfmuYiNywatDhmi48P8WbAVJ+CakLUXhDhEjzaHZwtVoAloJFp8bRJaqsnx8tXXeJEZZ26ptimaVzzTh1B25jLnu0F62EZvOKrVgghriwTU+GzFuQHScfRU= Received: from BN9P221CA0007.NAMP221.PROD.OUTLOOK.COM (2603:10b6:408:10a::26) by MW4PR12MB7431.namprd12.prod.outlook.com (2603:10b6:303:225::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.19; Thu, 9 Mar 2023 21:29:53 +0000 Received: from BN8NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10a:cafe::24) by BN9P221CA0007.outlook.office365.com (2603:10b6:408:10a::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.19 via Frontend Transport; Thu, 9 Mar 2023 21:29:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT032.mail.protection.outlook.com (10.13.177.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.19 via Frontend Transport; Thu, 9 Mar 2023 21:29:53 +0000 Received: from hamza-pc.localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 9 Mar 2023 15:29:51 -0600 From: Hamza Mahfooz To: CC: Hamza Mahfooz , Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , Lyude Paul , Wayne Lin , Qingqing Zhuo , Ian Chen , Sung Joon Kim , , Subject: [PATCH] drm/amd/display: use a more accurate check in dm_helpers_dp_read_dpcd() Date: Thu, 9 Mar 2023 16:30:27 -0500 Message-ID: <20230309213027.256243-1-hamza.mahfooz@amd.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT032:EE_|MW4PR12MB7431:EE_ X-MS-Office365-Filtering-Correlation-Id: fb56bde7-5c1d-48bc-524d-08db20e56bcf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bKLD+DUrDEMEAKn4YlwHW/FEIsOxEfHJafvFW+ka6yeaEZ6WtRNcHK7iwF/9qzcU47/w0+THjff29qQVu6Qo7bHJRNBlmdS/5rYuqwvZVZ07Bp/ZRPs93d9ZZfxcvaeFLCY+8fucSE6VY8FpuvYTI6mW0RzAC0H5i8ptozGvFV26T1JxYix7/xPmr+MaKUGZME+5oWLj1IgghMLUyYHv/XMt9rIUGmC1ylnTJvqW1o1HujPYWZ+nr9NW8RBpWYUzfSlZGwnMnGrcTkr/Kp+DXdR+6GUcl23ymI0qc9UyQUR4KMdHvQ332UG6eh7RfryEcMOZzg3Be4R1LwVhiIFvQu5jsfDswtjaUPkM1Alsp2GhGYPThy/ohhKGhSh31NzZTJ0eQWw6PJVfelJMqZHCTO26kRfwPmAGi/EBTqpNCYEvoOcyjGiweE9cwZ5s6QjCgDTZbcM1JoN1QZ2tbItPYJwZCBTZZh+yit5ME0V8muzxtEcdxwK3NHk3BcvO3P0eaZ7ceyorPWpjEwAHhAuRej08gQgqULZEPWw4xifJX2QpspGGaLAUMNQSR3CqKAecANcX/vfqA0ylw2tg3pVZrYg4Mot+dn0vwKmOlt4zcV1vo1luZoE1XpUa+X8efG71ba1C2hY9MVVtEsJij9/WyRW/8V8PuvHbxmW+VC7GA5+kTe0XiL5Iw+WI3ruZ3UGK5oSw59J3+B0mJCpxUungeX2jyrVOSFwzcyYIcBR2e6j+t6aHLJE1dJ78hKWva3kkK81mWLUX9Q1NOvEU5fIqeg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(346002)(376002)(136003)(396003)(39860400002)(451199018)(40470700004)(36840700001)(46966006)(82310400005)(36860700001)(83380400001)(82740400003)(426003)(47076005)(36756003)(54906003)(478600001)(316002)(356005)(2616005)(40480700001)(40460700003)(16526019)(26005)(6666004)(336012)(81166007)(186003)(1076003)(5660300002)(44832011)(2906002)(70586007)(8936002)(41300700001)(70206006)(4326008)(6916009)(86362001)(8676002)(16060500005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2023 21:29:53.0937 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fb56bde7-5c1d-48bc-524d-08db20e56bcf X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7431 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759927820064780140?= X-GMAIL-MSGID: =?utf-8?q?1759927820064780140?= We should be checking if drm_dp_dpcd_read() returns the size that we are asking it to read instead of just checking if it is greater than zero. Also, we should WARN_ON() here since this condition is only ever met, if there is an issue worth investigating. So, compare the return value of drm_dp_dpcd_read() to size and WARN_ON() if they aren't equal. Signed-off-by: Hamza Mahfooz Reviewed-by: Rodrigo Siqueira --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c index 8d598b322e5b..ed2ed7b1d869 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c @@ -511,8 +511,8 @@ bool dm_helpers_dp_read_dpcd( return false; } - return drm_dp_dpcd_read(&aconnector->dm_dp_aux.aux, address, - data, size) > 0; + return !WARN_ON(drm_dp_dpcd_read(&aconnector->dm_dp_aux.aux, address, + data, size) != size); } bool dm_helpers_dp_write_dpcd(