lkml.org 
[lkml]   [2020]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@huawei.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/

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2020-05-29 14:16    [W:0.038 / U:0.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site