* [PATCH] i2c-mxs: fix compile warning in mxs_i2c_xfer()
@ 2011-11-24 7:52 Shawn Guo
[not found] ` <1322121140-5216-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
0 siblings, 1 reply; 12+ messages in thread
From: Shawn Guo @ 2011-11-24 7:52 UTC (permalink / raw)
To: Ben Dooks
Cc: Wolfram Sang, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Shawn Guo
CC drivers/i2c/busses/i2c-mxs.o
drivers/i2c/busses/i2c-mxs.c: In function ‘mxs_i2c_xfer’:
drivers/i2c/busses/i2c-mxs.c:196:6: warning: ‘data’ may be used uninitialized in this function
Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
drivers/i2c/busses/i2c-mxs.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 7e78f7c..00f098f 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -193,7 +193,7 @@ static int mxs_i2c_wait_for_data(struct mxs_i2c_dev *i2c)
static int mxs_i2c_finish_read(struct mxs_i2c_dev *i2c, u8 *buf, int len)
{
- u32 data;
+ u32 data = 0;
int i;
for (i = 0; i < len; i++) {
--
1.7.4.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] i2c-mxs: fix compile warning in mxs_i2c_xfer()
[not found] ` <1322121140-5216-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2011-11-24 8:00 ` Wolfram Sang
[not found] ` <20111124080004.GD8439-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2011-11-24 8:29 ` Uwe Kleine-König
1 sibling, 1 reply; 12+ messages in thread
From: Wolfram Sang @ 2011-11-24 8:00 UTC (permalink / raw)
To: Shawn Guo
Cc: Ben Dooks, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
[-- Attachment #1: Type: text/plain, Size: 566 bytes --]
On Thu, Nov 24, 2011 at 03:52:20PM +0800, Shawn Guo wrote:
> CC drivers/i2c/busses/i2c-mxs.o
> drivers/i2c/busses/i2c-mxs.c: In function ‘mxs_i2c_xfer’:
> drivers/i2c/busses/i2c-mxs.c:196:6: warning: ‘data’ may be used uninitialized in this function
>
> Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Which compiler? What flags? I don't see that here.
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] i2c-mxs: fix compile warning in mxs_i2c_xfer()
[not found] ` <20111124080004.GD8439-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2011-11-24 8:24 ` Shawn Guo
0 siblings, 0 replies; 12+ messages in thread
From: Shawn Guo @ 2011-11-24 8:24 UTC (permalink / raw)
To: Wolfram Sang
Cc: Shawn Guo, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-i2c-u79uwXL29TY76Z2rM5mHXA, Ben Dooks
On Thu, Nov 24, 2011 at 09:00:04AM +0100, Wolfram Sang wrote:
> On Thu, Nov 24, 2011 at 03:52:20PM +0800, Shawn Guo wrote:
> > CC drivers/i2c/busses/i2c-mxs.o
> > drivers/i2c/busses/i2c-mxs.c: In function ‘mxs_i2c_xfer’:
> > drivers/i2c/busses/i2c-mxs.c:196:6: warning: ‘data’ may be used uninitialized in this function
> >
> > Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>
> Which compiler? What flags? I don't see that here.
>
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu3)
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j 2 zImage
--
Regards,
Shawn
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] i2c-mxs: fix compile warning in mxs_i2c_xfer()
[not found] ` <1322121140-5216-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-11-24 8:00 ` Wolfram Sang
@ 2011-11-24 8:29 ` Uwe Kleine-König
[not found] ` <20111124082903.GV19986-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
1 sibling, 1 reply; 12+ messages in thread
From: Uwe Kleine-König @ 2011-11-24 8:29 UTC (permalink / raw)
To: Shawn Guo
Cc: Ben Dooks, Wolfram Sang,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-i2c-u79uwXL29TY76Z2rM5mHXA
Hello Shawn,
On Thu, Nov 24, 2011 at 03:52:20PM +0800, Shawn Guo wrote:
> CC drivers/i2c/busses/i2c-mxs.o
> drivers/i2c/busses/i2c-mxs.c: In function ‘mxs_i2c_xfer’:
> drivers/i2c/busses/i2c-mxs.c:196:6: warning: ‘data’ may be used uninitialized in this function
>
> Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> drivers/i2c/busses/i2c-mxs.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
> index 7e78f7c..00f098f 100644
> --- a/drivers/i2c/busses/i2c-mxs.c
> +++ b/drivers/i2c/busses/i2c-mxs.c
> @@ -193,7 +193,7 @@ static int mxs_i2c_wait_for_data(struct mxs_i2c_dev *i2c)
>
> static int mxs_i2c_finish_read(struct mxs_i2c_dev *i2c, u8 *buf, int len)
> {
> - u32 data;
> + u32 data = 0;
> int i;
>
> for (i = 0; i < len; i++) {
Looks like a stupid compiler. Then better use
u32 uninitialized_var(data);
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] i2c-mxs: fix compile warning in mxs_i2c_xfer()
[not found] ` <20111124082903.GV19986-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2011-11-24 8:37 ` Wolfram Sang
[not found] ` <20111124083747.GE8439-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
0 siblings, 1 reply; 12+ messages in thread
From: Wolfram Sang @ 2011-11-24 8:37 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Shawn Guo, Ben Dooks,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-i2c-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 1364 bytes --]
On Thu, Nov 24, 2011 at 09:29:03AM +0100, Uwe Kleine-König wrote:
> Hello Shawn,
>
> On Thu, Nov 24, 2011 at 03:52:20PM +0800, Shawn Guo wrote:
> > CC drivers/i2c/busses/i2c-mxs.o
> > drivers/i2c/busses/i2c-mxs.c: In function ‘mxs_i2c_xfer’:
> > drivers/i2c/busses/i2c-mxs.c:196:6: warning: ‘data’ may be used uninitialized in this function
> >
> > Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > ---
> > drivers/i2c/busses/i2c-mxs.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
> > index 7e78f7c..00f098f 100644
> > --- a/drivers/i2c/busses/i2c-mxs.c
> > +++ b/drivers/i2c/busses/i2c-mxs.c
> > @@ -193,7 +193,7 @@ static int mxs_i2c_wait_for_data(struct mxs_i2c_dev *i2c)
> >
> > static int mxs_i2c_finish_read(struct mxs_i2c_dev *i2c, u8 *buf, int len)
> > {
> > - u32 data;
> > + u32 data = 0;
> > int i;
> >
> > for (i = 0; i < len; i++) {
> Looks like a stupid compiler. Then better use
>
> u32 uninitialized_var(data);
Leave it as it is and fix the compiler? Will do another test later to make
sure.
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH] i2c-mxs: fix compile warning in mxs_i2c_xfer()
[not found] ` <20111124083747.GE8439-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2011-11-24 9:02 ` Dong Aisheng-B29396
[not found] ` <65EE16ACC360FA4D99C96DC085B3F77233A4E4-TcFNo7jSaXPiTqIcKZ1S2K4g8xLGJsHaLnY5E4hWTkheoWH0uzbU5w@public.gmane.org>
2011-11-24 9:11 ` Lothar Waßmann
2011-11-25 1:15 ` Shawn Guo
1 sibling, 2 replies; 12+ messages in thread
From: Dong Aisheng-B29396 @ 2011-11-24 9:02 UTC (permalink / raw)
To: Wolfram Sang, Uwe Kleine-König
Cc: Shawn Guo,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
Ben Dooks, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> -----Original Message-----
> From: linux-arm-kernel-bounces@lists.infradead.org [mailto:linux-arm-
> kernel-bounces@lists.infradead.org] On Behalf Of Wolfram Sang
> Sent: Thursday, November 24, 2011 4:38 PM
> To: Uwe Kleine-König
> Cc: Shawn Guo; linux-arm-kernel@lists.infradead.org; Ben Dooks; linux-
> i2c@vger.kernel.org
> Subject: Re: [PATCH] i2c-mxs: fix compile warning in mxs_i2c_xfer()
>
> On Thu, Nov 24, 2011 at 09:29:03AM +0100, Uwe Kleine-König wrote:
> > Hello Shawn,
> >
> > On Thu, Nov 24, 2011 at 03:52:20PM +0800, Shawn Guo wrote:
> > > CC drivers/i2c/busses/i2c-mxs.o
> > > drivers/i2c/busses/i2c-mxs.c: In function ‘mxs_i2c_xfer’:
> > > drivers/i2c/busses/i2c-mxs.c:196:6: warning: ‘data’ may be used
> > > uninitialized in this function
> > >
> > > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > > ---
> > > drivers/i2c/busses/i2c-mxs.c | 2 +-
> > > 1 files changed, 1 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/drivers/i2c/busses/i2c-mxs.c
> > > b/drivers/i2c/busses/i2c-mxs.c index 7e78f7c..00f098f 100644
> > > --- a/drivers/i2c/busses/i2c-mxs.c
> > > +++ b/drivers/i2c/busses/i2c-mxs.c
> > > @@ -193,7 +193,7 @@ static int mxs_i2c_wait_for_data(struct
> > > mxs_i2c_dev *i2c)
> > >
> > > static int mxs_i2c_finish_read(struct mxs_i2c_dev *i2c, u8 *buf,
> > > int len) {
> > > - u32 data;
> > > + u32 data = 0;
> > > int i;
> > >
> > > for (i = 0; i < len; i++) {
> > Looks like a stupid compiler. Then better use
> >
> > u32 uninitialized_var(data);
>
> Leave it as it is and fix the compiler? Will do another test later to
> make sure.
>
Compiler is wrong?
Just from the code that it seems to be right the 'data' might be used
uninitialized.
Something I missed?
static int mxs_i2c_finish_read(struct mxs_i2c_dev *i2c, u8 *buf, int len)
{
u32 data;
int i;
for (i = 0; i < len; i++) {
if ((i & 3) == 0) {
if (mxs_i2c_wait_for_data(i2c))
return -ETIMEDOUT;
data = readl(i2c->regs + MXS_I2C_QUEUEDATA);
}
buf[i] = data & 0xff;
data >>= 8;
}
return 0;
}
Regards
Dong Aisheng
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] i2c-mxs: fix compile warning in mxs_i2c_xfer()
[not found] ` <65EE16ACC360FA4D99C96DC085B3F77233A4E4-TcFNo7jSaXPiTqIcKZ1S2K4g8xLGJsHaLnY5E4hWTkheoWH0uzbU5w@public.gmane.org>
@ 2011-11-24 9:06 ` Uwe Kleine-König
[not found] ` <20111124090653.GX19986-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
0 siblings, 1 reply; 12+ messages in thread
From: Uwe Kleine-König @ 2011-11-24 9:06 UTC (permalink / raw)
To: Dong Aisheng-B29396
Cc: Wolfram Sang, Shawn Guo,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
Ben Dooks, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Hello,
On Thu, Nov 24, 2011 at 09:02:21AM +0000, Dong Aisheng-B29396 wrote:
> > > > diff --git a/drivers/i2c/busses/i2c-mxs.c
> > > > b/drivers/i2c/busses/i2c-mxs.c index 7e78f7c..00f098f 100644
> > > > --- a/drivers/i2c/busses/i2c-mxs.c
> > > > +++ b/drivers/i2c/busses/i2c-mxs.c
> > > > @@ -193,7 +193,7 @@ static int mxs_i2c_wait_for_data(struct
> > > > mxs_i2c_dev *i2c)
> > > >
> > > > static int mxs_i2c_finish_read(struct mxs_i2c_dev *i2c, u8 *buf,
> > > > int len) {
> > > > - u32 data;
> > > > + u32 data = 0;
> > > > int i;
> > > >
> > > > for (i = 0; i < len; i++) {
> > > Looks like a stupid compiler. Then better use
> > >
> > > u32 uninitialized_var(data);
> >
> > Leave it as it is and fix the compiler? Will do another test later to
> > make sure.
> >
>
> Compiler is wrong?
> Just from the code that it seems to be right the 'data' might be used
> uninitialized.
>
> Something I missed?
>
> static int mxs_i2c_finish_read(struct mxs_i2c_dev *i2c, u8 *buf, int len)
> {
> u32 data;
> int i;
>
> for (i = 0; i < len; i++) {
> if ((i & 3) == 0) {
> if (mxs_i2c_wait_for_data(i2c))
> return -ETIMEDOUT;
> data = readl(i2c->regs + MXS_I2C_QUEUEDATA);
> }
> buf[i] = data & 0xff;
> data >>= 8;
> }
When data is used the first time, i is 0, so it went through the body of
the if above before which assigned data. So no, data is initialized when
used to assign buf[i].
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH] i2c-mxs: fix compile warning in mxs_i2c_xfer()
[not found] ` <20111124090653.GX19986-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2011-11-24 9:09 ` Dong Aisheng-B29396
0 siblings, 0 replies; 12+ messages in thread
From: Dong Aisheng-B29396 @ 2011-11-24 9:09 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Wolfram Sang, Shawn Guo,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
Ben Dooks, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> -----Original Message-----
> From: Uwe Kleine-König [mailto:u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org]
> Sent: Thursday, November 24, 2011 5:07 PM
> To: Dong Aisheng-B29396
> Cc: Wolfram Sang; Shawn Guo; linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org; Ben
> Dooks; linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Subject: Re: [PATCH] i2c-mxs: fix compile warning in mxs_i2c_xfer()
>
> Hello,
>
> On Thu, Nov 24, 2011 at 09:02:21AM +0000, Dong Aisheng-B29396 wrote:
> > > > > diff --git a/drivers/i2c/busses/i2c-mxs.c
> > > > > b/drivers/i2c/busses/i2c-mxs.c index 7e78f7c..00f098f 100644
> > > > > --- a/drivers/i2c/busses/i2c-mxs.c
> > > > > +++ b/drivers/i2c/busses/i2c-mxs.c
> > > > > @@ -193,7 +193,7 @@ static int mxs_i2c_wait_for_data(struct
> > > > > mxs_i2c_dev *i2c)
> > > > >
> > > > > static int mxs_i2c_finish_read(struct mxs_i2c_dev *i2c, u8
> > > > > *buf, int len) {
> > > > > - u32 data;
> > > > > + u32 data = 0;
> > > > > int i;
> > > > >
> > > > > for (i = 0; i < len; i++) {
> > > > Looks like a stupid compiler. Then better use
> > > >
> > > > u32 uninitialized_var(data);
> > >
> > > Leave it as it is and fix the compiler? Will do another test later
> > > to make sure.
> > >
> >
> > Compiler is wrong?
> > Just from the code that it seems to be right the 'data' might be used
> > uninitialized.
> >
> > Something I missed?
> >
> > static int mxs_i2c_finish_read(struct mxs_i2c_dev *i2c, u8 *buf, int
> > len) {
> > u32 data;
> > int i;
> >
> > for (i = 0; i < len; i++) {
> > if ((i & 3) == 0) {
> > if (mxs_i2c_wait_for_data(i2c))
> > return -ETIMEDOUT;
> > data = readl(i2c->regs + MXS_I2C_QUEUEDATA);
> > }
> > buf[i] = data & 0xff;
> > data >>= 8;
> > }
> When data is used the first time, i is 0, so it went through the body of
> the if above before which assigned data. So no, data is initialized when
> used to assign buf[i].
>
Ok, Thanks for the info.
So the compiler should do intelligent checking.
Regards
Dong Aisheng
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH] i2c-mxs: fix compile warning in mxs_i2c_xfer()
2011-11-24 9:02 ` Dong Aisheng-B29396
[not found] ` <65EE16ACC360FA4D99C96DC085B3F77233A4E4-TcFNo7jSaXPiTqIcKZ1S2K4g8xLGJsHaLnY5E4hWTkheoWH0uzbU5w@public.gmane.org>
@ 2011-11-24 9:11 ` Lothar Waßmann
1 sibling, 0 replies; 12+ messages in thread
From: Lothar Waßmann @ 2011-11-24 9:11 UTC (permalink / raw)
To: Dong Aisheng-B29396
Cc: Wolfram Sang, linux-i2c@vger.kernel.org, Ben Dooks,
Uwe Kleine-König, Shawn Guo,
linux-arm-kernel@lists.infradead.org
Hi,
Dong Aisheng-B29396 writes:
> > -----Original Message-----
> > From: linux-arm-kernel-bounces@lists.infradead.org [mailto:linux-arm-
> > kernel-bounces@lists.infradead.org] On Behalf Of Wolfram Sang
> > Sent: Thursday, November 24, 2011 4:38 PM
> > To: Uwe Kleine-König
> > Cc: Shawn Guo; linux-arm-kernel@lists.infradead.org; Ben Dooks; linux-
> > i2c@vger.kernel.org
> > Subject: Re: [PATCH] i2c-mxs: fix compile warning in mxs_i2c_xfer()
> >
> > On Thu, Nov 24, 2011 at 09:29:03AM +0100, Uwe Kleine-König wrote:
> > > Hello Shawn,
> > >
> > > On Thu, Nov 24, 2011 at 03:52:20PM +0800, Shawn Guo wrote:
> > > > CC drivers/i2c/busses/i2c-mxs.o
> > > > drivers/i2c/busses/i2c-mxs.c: In function ‘mxs_i2c_xfer’:
> > > > drivers/i2c/busses/i2c-mxs.c:196:6: warning: ‘data’ may be used
> > > > uninitialized in this function
> > > >
> > > > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > > > ---
> > > > drivers/i2c/busses/i2c-mxs.c | 2 +-
> > > > 1 files changed, 1 insertions(+), 1 deletions(-)
> > > >
> > > > diff --git a/drivers/i2c/busses/i2c-mxs.c
> > > > b/drivers/i2c/busses/i2c-mxs.c index 7e78f7c..00f098f 100644
> > > > --- a/drivers/i2c/busses/i2c-mxs.c
> > > > +++ b/drivers/i2c/busses/i2c-mxs.c
> > > > @@ -193,7 +193,7 @@ static int mxs_i2c_wait_for_data(struct
> > > > mxs_i2c_dev *i2c)
> > > >
> > > > static int mxs_i2c_finish_read(struct mxs_i2c_dev *i2c, u8 *buf,
> > > > int len) {
> > > > - u32 data;
> > > > + u32 data = 0;
> > > > int i;
> > > >
> > > > for (i = 0; i < len; i++) {
> > > Looks like a stupid compiler. Then better use
> > >
> > > u32 uninitialized_var(data);
> >
> > Leave it as it is and fix the compiler? Will do another test later to
> > make sure.
> >
>
> Compiler is wrong?
> Just from the code that it seems to be right the 'data' might be used
> uninitialized.
>
Only iff you assume that (0 & 3) could be != 0...
Lothar Waßmann
--
___________________________________________________________
Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996
www.karo-electronics.de | info@karo-electronics.de
___________________________________________________________
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] i2c-mxs: fix compile warning in mxs_i2c_xfer()
[not found] ` <20111124083747.GE8439-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2011-11-24 9:02 ` Dong Aisheng-B29396
@ 2011-11-25 1:15 ` Shawn Guo
[not found] ` <20111125011519.GA18403-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
1 sibling, 1 reply; 12+ messages in thread
From: Shawn Guo @ 2011-11-25 1:15 UTC (permalink / raw)
To: Ben Dooks, Wolfram Sang
Cc: Uwe Kleine-König, Shawn Guo,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-i2c-u79uwXL29TY76Z2rM5mHXA
On Thu, Nov 24, 2011 at 09:37:47AM +0100, Wolfram Sang wrote:
> On Thu, Nov 24, 2011 at 09:29:03AM +0100, Uwe Kleine-König wrote:
> > Hello Shawn,
> >
> > On Thu, Nov 24, 2011 at 03:52:20PM +0800, Shawn Guo wrote:
> > > CC drivers/i2c/busses/i2c-mxs.o
> > > drivers/i2c/busses/i2c-mxs.c: In function ‘mxs_i2c_xfer’:
> > > drivers/i2c/busses/i2c-mxs.c:196:6: warning: ‘data’ may be used uninitialized in this function
> > >
> > > Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > > ---
> > > drivers/i2c/busses/i2c-mxs.c | 2 +-
> > > 1 files changed, 1 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
> > > index 7e78f7c..00f098f 100644
> > > --- a/drivers/i2c/busses/i2c-mxs.c
> > > +++ b/drivers/i2c/busses/i2c-mxs.c
> > > @@ -193,7 +193,7 @@ static int mxs_i2c_wait_for_data(struct mxs_i2c_dev *i2c)
> > >
> > > static int mxs_i2c_finish_read(struct mxs_i2c_dev *i2c, u8 *buf, int len)
> > > {
> > > - u32 data;
> > > + u32 data = 0;
> > > int i;
> > >
> > > for (i = 0; i < len; i++) {
> > Looks like a stupid compiler. Then better use
> >
> > u32 uninitialized_var(data);
>
> Leave it as it is and fix the compiler? Will do another test later to make
> sure.
>
Ben, do you have an opinion on this, leave it there or fix it?
--
Regards,
Shawn
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] i2c-mxs: fix compile warning in mxs_i2c_xfer()
[not found] ` <20111125011519.GA18403-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
@ 2011-11-25 9:08 ` Wolfram Sang
[not found] ` <20111125090806.GA2535-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
0 siblings, 1 reply; 12+ messages in thread
From: Wolfram Sang @ 2011-11-25 9:08 UTC (permalink / raw)
To: Shawn Guo
Cc: Ben Dooks, Uwe Kleine-König, Shawn Guo,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-i2c-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 1824 bytes --]
On Fri, Nov 25, 2011 at 09:15:20AM +0800, Shawn Guo wrote:
> On Thu, Nov 24, 2011 at 09:37:47AM +0100, Wolfram Sang wrote:
> > On Thu, Nov 24, 2011 at 09:29:03AM +0100, Uwe Kleine-König wrote:
> > > Hello Shawn,
> > >
> > > On Thu, Nov 24, 2011 at 03:52:20PM +0800, Shawn Guo wrote:
> > > > CC drivers/i2c/busses/i2c-mxs.o
> > > > drivers/i2c/busses/i2c-mxs.c: In function ‘mxs_i2c_xfer’:
> > > > drivers/i2c/busses/i2c-mxs.c:196:6: warning: ‘data’ may be used uninitialized in this function
> > > >
> > > > Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > > > ---
> > > > drivers/i2c/busses/i2c-mxs.c | 2 +-
> > > > 1 files changed, 1 insertions(+), 1 deletions(-)
> > > >
> > > > diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
> > > > index 7e78f7c..00f098f 100644
> > > > --- a/drivers/i2c/busses/i2c-mxs.c
> > > > +++ b/drivers/i2c/busses/i2c-mxs.c
> > > > @@ -193,7 +193,7 @@ static int mxs_i2c_wait_for_data(struct mxs_i2c_dev *i2c)
> > > >
> > > > static int mxs_i2c_finish_read(struct mxs_i2c_dev *i2c, u8 *buf, int len)
> > > > {
> > > > - u32 data;
> > > > + u32 data = 0;
> > > > int i;
> > > >
> > > > for (i = 0; i < len; i++) {
> > > Looks like a stupid compiler. Then better use
> > >
> > > u32 uninitialized_var(data);
> >
> > Leave it as it is and fix the compiler? Will do another test later to make
> > sure.
> >
> Ben, do you have an opinion on this, leave it there or fix it?
Sorry, forgot the tests yesterday. I don't like random annotations
because of faulty compilers. Please fix that one. NACK from me.
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] i2c-mxs: fix compile warning in mxs_i2c_xfer()
[not found] ` <20111125090806.GA2535-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2011-12-02 19:42 ` Marek Vasut
0 siblings, 0 replies; 12+ messages in thread
From: Marek Vasut @ 2011-12-02 19:42 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: Wolfram Sang, Shawn Guo, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
Shawn Guo, Ben Dooks, Uwe Kleine-König
> On Fri, Nov 25, 2011 at 09:15:20AM +0800, Shawn Guo wrote:
> > On Thu, Nov 24, 2011 at 09:37:47AM +0100, Wolfram Sang wrote:
> > > On Thu, Nov 24, 2011 at 09:29:03AM +0100, Uwe Kleine-König wrote:
> > > > Hello Shawn,
> > > >
> > > > On Thu, Nov 24, 2011 at 03:52:20PM +0800, Shawn Guo wrote:
> > > > > CC drivers/i2c/busses/i2c-mxs.o
> > > > >
> > > > > drivers/i2c/busses/i2c-mxs.c: In function ‘mxs_i2c_xfer’:
> > > > > drivers/i2c/busses/i2c-mxs.c:196:6: warning: ‘data’ may be used
> > > > > uninitialized in this function
> > > > >
> > > > > Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > > > > ---
> > > > >
> > > > > drivers/i2c/busses/i2c-mxs.c | 2 +-
> > > > > 1 files changed, 1 insertions(+), 1 deletions(-)
> > > > >
> > > > > diff --git a/drivers/i2c/busses/i2c-mxs.c
> > > > > b/drivers/i2c/busses/i2c-mxs.c index 7e78f7c..00f098f 100644
> > > > > --- a/drivers/i2c/busses/i2c-mxs.c
> > > > > +++ b/drivers/i2c/busses/i2c-mxs.c
> > > > > @@ -193,7 +193,7 @@ static int mxs_i2c_wait_for_data(struct
> > > > > mxs_i2c_dev *i2c)
> > > > >
> > > > > static int mxs_i2c_finish_read(struct mxs_i2c_dev *i2c, u8 *buf,
> > > > > int len) {
> > > > >
> > > > > - u32 data;
> > > > > + u32 data = 0;
> > > > >
> > > > > int i;
> > > > >
> > > > > for (i = 0; i < len; i++) {
> > > >
> > > > Looks like a stupid compiler. Then better use
> > > >
> > > > u32 uninitialized_var(data);
> > >
> > > Leave it as it is and fix the compiler? Will do another test later to
> > > make sure.
> >
> > Ben, do you have an opinion on this, leave it there or fix it?
>
> Sorry, forgot the tests yesterday. I don't like random annotations
> because of faulty compilers. Please fix that one. NACK from me.
Hi,
I hit this with emdebian gcc 4.6.1 ... I'd be for merging this u32 data = 0;
stuff, so on my side it's ACK.
M
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2011-12-02 19:42 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-24 7:52 [PATCH] i2c-mxs: fix compile warning in mxs_i2c_xfer() Shawn Guo
[not found] ` <1322121140-5216-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-11-24 8:00 ` Wolfram Sang
[not found] ` <20111124080004.GD8439-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2011-11-24 8:24 ` Shawn Guo
2011-11-24 8:29 ` Uwe Kleine-König
[not found] ` <20111124082903.GV19986-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2011-11-24 8:37 ` Wolfram Sang
[not found] ` <20111124083747.GE8439-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2011-11-24 9:02 ` Dong Aisheng-B29396
[not found] ` <65EE16ACC360FA4D99C96DC085B3F77233A4E4-TcFNo7jSaXPiTqIcKZ1S2K4g8xLGJsHaLnY5E4hWTkheoWH0uzbU5w@public.gmane.org>
2011-11-24 9:06 ` Uwe Kleine-König
[not found] ` <20111124090653.GX19986-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2011-11-24 9:09 ` Dong Aisheng-B29396
2011-11-24 9:11 ` Lothar Waßmann
2011-11-25 1:15 ` Shawn Guo
[not found] ` <20111125011519.GA18403-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-11-25 9:08 ` Wolfram Sang
[not found] ` <20111125090806.GA2535-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2011-12-02 19:42 ` Marek Vasut
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).