From patchwork Mon Oct 24 11:29:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9078 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445468wru; Mon, 24 Oct 2022 06:12:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5XC8uOd4hQABssuTT1DWVPg4qVIYJoHeo2sAGg7C1yuR1QRZJjvuIWjVdqa3jcLfA6xTlv X-Received: by 2002:a17:90b:1c8d:b0:203:cc25:4eb5 with SMTP id oo13-20020a17090b1c8d00b00203cc254eb5mr38426795pjb.132.1666617148183; Mon, 24 Oct 2022 06:12:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617148; cv=none; d=google.com; s=arc-20160816; b=Ej55pDyhHadqAyDu2gJCe83olYDfiMZP8yNyj1fm0TNeKauYJUfBIHqI67R5fowJOk Wx8aBrMLF0tDvH0clQdsUCwAUoR+y1VPQlpkjaeAjIm+IjVjDEDId00BZyZZUtqNB5is VZTjN4x/Qa8llB1JJHUD/QItQeVEpK25QnPru3uNlfXekyL9q7N8RSyVI7jQs0I+0E/G bWhIFUt9JSzTqVGx+fnzjuggVRUi4nQUV3hmkTq5KZhP5hIxlbqlLGXzbAoYN//3vpN+ ibsi75j3QE1ucng2f5Co0Zgl20ldL1wl82WN3NP8YOuMAsJ0S8KhVurmOZ5yoC5q5yMU 9c/w== 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=VXWdft55rwFsbQ36It/JlBXH/tOjtqSD/Fx8d7+lvFo=; b=HsG8co4G17KCamHVMEnn2BGg+NkecaYOFhD0ZcP+dRkHaBTBhomEZNTJe2dyS3IDW4 Loj/scLGESDq7NSzXCwOuJu3enOc9txNiAvYqxOT/5hZLaxF0r1pU4qQCD1QsyEyZJub TE4u9gJ8hXx1VNERyKTwuLN5hFVnIDFk2BT4By7+lMMkiHK6R8fl0axfmJiGNwLoHR94 RbIjc4HdGMe5gQTvCYmlJRGr4IjVzGwupaNXQNLjIF9DwPwDP4GNINTQawSb56f0a7+p nkbaJ3Rtko7uDLQn0cdzr0H8I1Vc8eDJ9ibFYGC5MkkCtRH4xE5T1r+g2fxH5yPhzXM0 tVsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rNNbYes0; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a170902f35100b001868a61d507si6533556ple.180.2022.10.24.06.12.14; Mon, 24 Oct 2022 06:12:28 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=rNNbYes0; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235632AbiJXNLx (ORCPT + 99 others); Mon, 24 Oct 2022 09:11:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235640AbiJXNJM (ORCPT ); Mon, 24 Oct 2022 09:09:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 746539F749; Mon, 24 Oct 2022 05:22:18 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 07850612E7; Mon, 24 Oct 2022 12:22:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AD4EC433D6; Mon, 24 Oct 2022 12:22:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614137; bh=NDhl75XBw/Cv2H9f1biVIkMHuvFLt/dll9cekvRZ4cs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rNNbYes0EXswXmS5zp6xT7jKI8/VrBc73LHtlQh0xbSd+Xqng3L1Hlhfr/L2l0ma4 npkSbUsNyTZTaSk4z2vVEk36Chgr+D8g0S9ewkVdq/6rmW5VWdZRFqQ3MrruOursci i1URHsWo3P1X0ADZmDItOVxE4RVtgdqmgQde2zpk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Simon Ser , Lyude Paul , Benjamin Gaignard , Jani Nikula , Sasha Levin Subject: [PATCH 5.10 145/390] drm/dp_mst: fix drm_dp_dpcd_read return value checks Date: Mon, 24 Oct 2022 13:29:02 +0200 Message-Id: <20221024113028.858350468@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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?1747574742896585284?= X-GMAIL-MSGID: =?utf-8?q?1747574742896585284?= From: Simon Ser [ Upstream commit 2ac6cdd581f48c8f68747156fde5868486a44985 ] drm_dp_dpcd_read returns the number of bytes read. The previous code would print garbage on DPCD error, and would exit with on error on success. Signed-off-by: Simon Ser Fixes: cb897542c6d2 ("drm/dp_mst: Fix W=1 warnings") Cc: Lyude Paul Cc: Benjamin Gaignard Reviewed-by: Jani Nikula Link: https://patchwork.freedesktop.org/patch/473500/ Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_dp_mst_topology.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index ab423b0413ee..4272cd3622f8 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -4856,14 +4856,14 @@ void drm_dp_mst_dump_topology(struct seq_file *m, seq_printf(m, "dpcd: %*ph\n", DP_RECEIVER_CAP_SIZE, buf); ret = drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2); - if (ret) { + if (ret != 2) { seq_printf(m, "faux/mst read failed\n"); goto out; } seq_printf(m, "faux/mst: %*ph\n", 2, buf); ret = drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1); - if (ret) { + if (ret != 1) { seq_printf(m, "mst ctrl read failed\n"); goto out; } @@ -4871,7 +4871,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m, /* dump the standard OUI branch header */ ret = drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE); - if (ret) { + if (ret != DP_BRANCH_OUI_HEADER_SIZE) { seq_printf(m, "branch oui read failed\n"); goto out; }