[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAE-0n5199hd1wUtsYpDVRHDwtP75wHB-44Hj9AF5fdGrN_nATQ@mail.gmail.com>
Date: Wed, 13 Dec 2023 17:05:04 -0800
From: Stephen Boyd <swboyd@...omium.org>
To: Douglas Anderson <dianders@...omium.org>,
dri-devel@...ts.freedesktop.org
Cc: Andrzej Hajda <andrzej.hajda@...el.com>,
Daniel Vetter <daniel@...ll.ch>,
David Airlie <airlied@...il.com>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Jonas Karlman <jonas@...boo.se>,
Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Neil Armstrong <neil.armstrong@...aro.org>,
Philip Chen <philipchen@...omium.org>,
Robert Foss <rfoss@...nel.org>,
Sam Ravnborg <sam@...nborg.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] drm/bridge: parade-ps8640: Never increase the length
when reading from AUX
Quoting Douglas Anderson (2023-12-11 16:55:26)
> diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridge/parade-ps8640.c
> index 8161b1a1a4b1..fb2ec4264549 100644
> --- a/drivers/gpu/drm/bridge/parade-ps8640.c
> +++ b/drivers/gpu/drm/bridge/parade-ps8640.c
> @@ -302,7 +302,7 @@ static ssize_t ps8640_aux_transfer_msg(struct drm_dp_aux *aux,
>
> fallthrough;
> case SWAUX_STATUS_ACKM:
> - len = data & SWAUX_M_MASK;
> + len = min(len, (unsigned int)(data & SWAUX_M_MASK));
> break;
> case SWAUX_STATUS_DEFER:
> case SWAUX_STATUS_I2C_DEFER:
> @@ -310,7 +310,7 @@ static ssize_t ps8640_aux_transfer_msg(struct drm_dp_aux *aux,
> msg->reply |= DP_AUX_NATIVE_REPLY_DEFER;
> else
> msg->reply |= DP_AUX_I2C_REPLY_DEFER;
> - len = data & SWAUX_M_MASK;
> + len = min(len, (unsigned int)(data & SWAUX_M_MASK));
> break;
> case SWAUX_STATUS_INVALID:
> return -EOPNOTSUPP;
If the hardware indicates the len is larger than the length of 'buf' do
we need to throw away reads of the fifo until we read the length that
we're told? I'm specifically looking at the read loop at the end of
ps8640_aux_transfer_msg() where it reads a byte at a time out of
'PAGE0_SWAUX_RDATA'. So maybe what we need to do is have 'buf_len' and
'len' and then return the min of the two at the end of the function but
only copy over 'buf_len' amount.
Powered by blists - more mailing lists