[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200529121501.GB20272@ninjato>
Date: Fri, 29 May 2020 14:15:01 +0200
From: Wolfram Sang <wsa+renesas@...g-engineering.com>
To: Zhen Lei <thunder.leizhen@...wei.com>
Cc: linux-i2c <linux-i2c@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1] i2c: sh_mobile: eliminate a misreported warning
On Wed, Apr 29, 2020 at 08:40:17PM +0800, Zhen Lei wrote:
> The warning is caused by the branches "if (pd->pos == -1)" and
> "if (pd->pos == 0)", because they appear after "real_pos = pd->pos - 2",
> so the compiler doesn't known the value of real_pos is negative through
> these two branches.
>
> To avoid this warning, eliminate the middleman "data".
>
> drivers/i2c/busses/i2c-sh_mobile.c: In function ‘sh_mobile_i2c_isr’:
> drivers/i2c/busses/i2c-sh_mobile.c:396:26: warning: ‘data’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> pd->msg->buf[real_pos] = data;
> ^
> drivers/i2c/busses/i2c-sh_mobile.c:369:16: note: ‘data’ was declared here
> unsigned char data;
>
> Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
Thanks for the patch and reminding me about the issue, it is correct.
However, an identical patch has been sent before and is now applied in
for-next:
http://patchwork.ozlabs.org/project/linux-i2c/patch/f526f90ea62741716de2ecfa310ba22d8cf1d3c2.1557377015.git.viresh.kumar@linaro.org/
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists