From patchwork Thu Feb 10 15:40:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12742105 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C6212C433F5 for ; Thu, 10 Feb 2022 15:40:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9348710E891; Thu, 10 Feb 2022 15:40:38 +0000 (UTC) Received: from mail-4317.proton.ch (mail-4317.proton.ch [185.70.43.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id C586110E891 for ; Thu, 10 Feb 2022 15:40:36 +0000 (UTC) Date: Thu, 10 Feb 2022 15:40:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail2; t=1644507633; bh=ECe2L9xWylm7q8RA9P0cKfPheXFnINjfWPDIgLNlj84=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID; b=SDKFNkc1XP0FclM8EeWusC1CSXDM9LIZUPeqZnXkJl9wBJKi7WX60MJs/33MV5lN8 9w5Gr4H90LtAjfEC833PKFK6VJJCrai1VghmsaS8YI9Dhm0Ww3uGn+d8v0D/ugG+sJ JFHt+hG08vACo5C/bz1RfGe3KXcwHoolMCs4jzc2boo2WhLds75dSOKPgDPRPIQIQ8 jIfpgNDZz+j2k1dTtmSp0CR8pUsWkHah9W3/aaSLyuXgxA4TlBeML71eOZfIRVnd9O P1F27o2t/7/nioFpc6UJvAy1+51GKQLEtGqmug0MW0WOp+HzY244IgpFllNrzUDec3 jQmcRPf1oiKnQ== To: dri-devel@lists.freedesktop.org From: Simon Ser Subject: [PATCH] drm/dp_mst: fix drm_dp_dpcd_read return value checks Message-ID: <20220210154012.118472-1-contact@emersion.fr> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Simon Ser Cc: Benjamin Gaignard Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- drivers/gpu/drm/dp/drm_dp_mst_topology.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) base-commit: ded74cafeea9311c1eaf6fccce963de2516145f7 diff --git a/drivers/gpu/drm/dp/drm_dp_mst_topology.c b/drivers/gpu/drm/dp/drm_dp_mst_topology.c index 11300b53d24f..f5998b7cf602 100644 --- a/drivers/gpu/drm/dp/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/dp/drm_dp_mst_topology.c @@ -4912,21 +4912,21 @@ void drm_dp_mst_dump_topology(struct seq_file *m, int ret; ret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf, DP_RECEIVER_CAP_SIZE); - if (ret) { + if (ret != DP_RECEIVER_CAP_SIZE) { seq_printf(m, "dpcd read failed\n"); goto out; } 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; } @@ -4934,7 +4934,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; }