All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Simon Ser <contact@emersion.fr>, dri-devel@lists.freedesktop.org
Cc: Benjamin Gaignard <benjamin.gaignard@st.com>
Subject: Re: [PATCH] drm/dp_mst: fix drm_dp_dpcd_read return value checks
Date: Thu, 10 Feb 2022 18:33:13 +0200	[thread overview]
Message-ID: <87y22i7kc6.fsf@intel.com> (raw)
In-Reply-To: <20220210154012.118472-1-contact@emersion.fr>

On Thu, 10 Feb 2022, Simon Ser <contact@emersion.fr> wrote:
> 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.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

I do wish we'd just made dpcd access return 0 when the number of bytes
transferred matches the request, and an error otherwise.

BR,
Jani.

>
> Signed-off-by: Simon Ser <contact@emersion.fr>
> Fixes: cb897542c6d2 ("drm/dp_mst: Fix W=1 warnings")
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: Benjamin Gaignard <benjamin.gaignard@st.com>
> ---
>  drivers/gpu/drm/dp/drm_dp_mst_topology.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> 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;
>  		}
>
> base-commit: ded74cafeea9311c1eaf6fccce963de2516145f7

-- 
Jani Nikula, Intel Open Source Graphics Center

      reply	other threads:[~2022-02-10 16:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10 15:40 [PATCH] drm/dp_mst: fix drm_dp_dpcd_read return value checks Simon Ser
2022-02-10 16:33 ` Jani Nikula [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y22i7kc6.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=benjamin.gaignard@st.com \
    --cc=contact@emersion.fr \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.