[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c79fd5b6-e999-5bec-e373-7709d07f4446@samsung.com>
Date: Mon, 13 Jul 2020 17:29:37 +0200
From: Andrzej Hajda <a.hajda@...sung.com>
To: trix@...hat.com, narmstrong@...libre.com,
Laurent.pinchart@...asonboard.com, jonas@...boo.se,
jernej.skrabec@...l.net, airlied@...ux.ie, daniel@...ll.ch,
architt@...eaurora.org
Cc: stable@...r.kernel.org, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH] drm/bridge: sil_sii8620: initialize return of
sii8620_readb
On 12.07.2020 17:24, trix@...hat.com wrote:
> From: Tom Rix <trix@...hat.com>
>
> clang static analysis flags this error
>
> sil-sii8620.c:184:2: warning: Undefined or garbage value
> returned to caller [core.uninitialized.UndefReturn]
> return ret;
> ^~~~~~~~~~
>
> sii8620_readb calls sii8620_read_buf.
> sii8620_read_buf can return without setting its output
> pararmeter 'ret'.
>
> So initialize ret.
>
> Fixes: ce6e153f414a ("drm/bridge: add Silicon Image SiI8620 driver")
>
> Signed-off-by: Tom Rix <trix@...hat.com>
> ---
> drivers/gpu/drm/bridge/sil-sii8620.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/sil-sii8620.c b/drivers/gpu/drm/bridge/sil-sii8620.c
> index 3540e4931383..da933d477e5f 100644
> --- a/drivers/gpu/drm/bridge/sil-sii8620.c
> +++ b/drivers/gpu/drm/bridge/sil-sii8620.c
> @@ -178,7 +178,7 @@ static void sii8620_read_buf(struct sii8620 *ctx, u16 addr, u8 *buf, int len)
>
> static u8 sii8620_readb(struct sii8620 *ctx, u16 addr)
> {
> - u8 ret;
> + u8 ret = 0;
In theory it shouldn't cause any harm, but this protections makes things
simpler.
Reviewed-by: Andrzej Hajda <a.hajda@...sung.com>
Regards
Andrzej
>
> sii8620_read_buf(ctx, addr, &ret, 1);
> return ret;
Powered by blists - more mailing lists