From: Guenter Roeck <linux@roeck-us.net>
To: Hsin-Yi Wang <hsinyi@chromium.org>
Cc: Robert Foss <robert.foss@linaro.org>,
Sam Ravnborg <sam@ravnborg.org>,
Nicolas Boichat <drinkcat@chromium.org>,
Pi-Hsun Shih <pihsun@chromium.org>,
Jonas Karlman <jonas@kwiboo.se>, David Airlie <airlied@linux.ie>,
dri-devel@lists.freedesktop.org,
Neil Armstrong <narmstrong@baylibre.com>,
linux-kernel@vger.kernel.org,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Andrzej Hajda <a.hajda@samsung.com>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Tzung-Bi Shih <tzungbi@google.com>, Xin Ji <xji@analogixsemi.com>
Subject: Re: [PATCH] drm/bridge: anx7625: Fix edid_read break case in sp_tx_edid_read()
Date: Thu, 18 Nov 2021 08:52:03 -0800 [thread overview]
Message-ID: <20211118165203.GA1721588@roeck-us.net> (raw)
In-Reply-To: <20211112112433.942075-1-hsinyi@chromium.org>
On Fri, Nov 12, 2021 at 07:24:33PM +0800, Hsin-Yi Wang wrote:
> edid_read() was assumed to return 0 on success. After
> 7f16d0f3b8e2("drm/bridge: anx7625: Propagate errors from sp_tx_rst_aux()"),
> the function can return >= 0 for successful case. Fix the g_edid_break
> condition in sp_tx_edid_read().
>
> Fixes: 7f16d0f3b8e2("drm/bridge: anx7625: Propagate errors from sp_tx_rst_aux()")
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> Reviewed-by: Robert Foss <robert.foss@linaro.org>
> ---
> drivers/gpu/drm/bridge/analogix/anx7625.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
> index 1a871f6b6822ee..392203b576042b 100644
> --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
> +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
> @@ -826,7 +826,7 @@ static int sp_tx_edid_read(struct anx7625_data *ctx,
> g_edid_break = edid_read(ctx, offset,
> pblock_buf);
>
> - if (g_edid_break)
> + if (g_edid_break < 0)
> break;
g_edid_break is declared u8 and thus never < 0. The break; statement
doesn't indicate an error but that a break was encountered, and the
value of g_edid_break == 1 is used elsewhere in the function to indicate
that condition. It also doesn't break out of the outer loop, but only
out of the switch statement.
With this patch in place, g_edid_break will have a more or less random
value after an error, and the behavior of this function will be undefined.
Guenter
next prev parent reply other threads:[~2021-11-18 16:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-12 11:24 [PATCH] drm/bridge: anx7625: Fix edid_read break case in sp_tx_edid_read() Hsin-Yi Wang
2021-11-18 14:53 ` Robert Foss
2021-11-18 16:52 ` Guenter Roeck [this message]
2021-11-18 19:08 ` Hsin-Yi Wang
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=20211118165203.GA1721588@roeck-us.net \
--to=linux@roeck-us.net \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=a.hajda@samsung.com \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=drinkcat@chromium.org \
--cc=hsinyi@chromium.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=linux-kernel@vger.kernel.org \
--cc=narmstrong@baylibre.com \
--cc=pihsun@chromium.org \
--cc=robert.foss@linaro.org \
--cc=sam@ravnborg.org \
--cc=tzungbi@google.com \
--cc=xji@analogixsemi.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox