From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: Zhen Lei <thunder.leizhen@huawei.com>
Cc: linux-i2c <linux-i2c@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] i2c: sh_mobile: eliminate a misreported warning
Date: Fri, 29 May 2020 14:15:01 +0200 [thread overview]
Message-ID: <20200529121501.GB20272@ninjato> (raw)
In-Reply-To: <20200429124017.397-1-thunder.leizhen@huawei.com>
[-- Attachment #1: Type: text/plain, Size: 1102 bytes --]
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/
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2020-05-29 12:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-29 12:40 [PATCH 1/1] i2c: sh_mobile: eliminate a misreported warning Zhen Lei
2020-05-29 12:15 ` Wolfram Sang [this message]
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=20200529121501.GB20272@ninjato \
--to=wsa+renesas@sang-engineering.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thunder.leizhen@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.