[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAG3jFytpOb8KeNCjCJ7gq20LQK3UGA9PgGne+cR2kZdADS-Oxg@mail.gmail.com>
Date: Tue, 18 May 2021 15:20:57 +0200
From: Robert Foss <robert.foss@...aro.org>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Andrzej Hajda <a.hajda@...sung.com>,
Neil Armstrong <narmstrong@...libre.com>,
Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
Jonas Karlman <jonas@...boo.se>,
Jernej Skrabec <jernej.skrabec@...il.com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Linus Walleij <linus.walleij@...aro.org>,
Douglas Anderson <dianders@...omium.org>,
dri-devel <dri-devel@...ts.freedesktop.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] drm/bridge: ti-sn65dsi86: fix a ternary type promotion bug
Hey Dan,
Thanks for submitting this.
On Tue, 18 May 2021 at 11:20, Dan Carpenter <dan.carpenter@...cle.com> wrote:
>
> The ti_sn_aux_transfer() function returns ssize_t (signed long). It's
> supposed to return negative error codes or the number of bytes
> transferred. The "ret" variable is int and the "len" variable is
> unsigned int.
>
> The problem is that with a ternary like this, the negative int is first
> type promoted to unsigned int to match "len" at this point it is a high
> positive value. Then when it is type promoted to ssize_t (s64) it
> remains a high positive value instead of sign extending and becoming a
> negative again.
>
> Fix this by removing the ternary.
>
> Fixes: b137406d9679 ("drm/bridge: ti-sn65dsi86: If refclk, DP AUX can happen w/out pre-enable")
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
> ---
> drivers/gpu/drm/bridge/ti-sn65dsi86.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> index bb0a0e1c6341..45a2969afb2b 100644
> --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> @@ -1042,7 +1042,9 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux,
> pm_runtime_mark_last_busy(pdata->dev);
> pm_runtime_put_autosuspend(pdata->dev);
>
> - return ret ? ret : len;
> + if (ret)
> + return ret;
> + return len;
> }
>
Reviewed-by: Robert Foss <robert.foss@...aro.org>
Applying to drm-misc-fixes.
Powered by blists - more mailing lists