* [PATCH] i2c: mxs: mxs_i2c_finish_read: mute flase positive uninitialized var @ 2012-07-01 21:34 Marc Kleine-Budde [not found] ` <1341178470-14904-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 0 siblings, 1 reply; 2+ messages in thread From: Marc Kleine-Budde @ 2012-07-01 21:34 UTC (permalink / raw) To: linux-i2c-u79uwXL29TY76Z2rM5mHXA Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, kernel-bIcnvbaLZ9MEGnE8C9+IrQ, Marc Kleine-Budde, Wolfram Sang This patch mutes the false positive compiler warning: drivers/i2c/busses/i2c-mxs.c: In function 'mxs_i2c_xfer_msg': drivers/i2c/busses/i2c-mxs.c:206:8: warning: 'data' may be used uninitialized in this function [-Wuninitialized] drivers/i2c/busses/i2c-mxs.c:196:6: note: 'data' was declared here Cc: "Wolfram Sang" <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> Signed-off-by: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> --- drivers/i2c/busses/i2c-mxs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 04eb441..02ce1fa 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 uninitialized_var(data); int i; for (i = 0; i < len; i++) { -- 1.7.10 ^ permalink raw reply related [flat|nested] 2+ messages in thread
[parent not found: <1341178470-14904-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>]
* Re: [PATCH] i2c: mxs: mxs_i2c_finish_read: mute flase positive uninitialized var [not found] ` <1341178470-14904-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> @ 2012-07-09 11:14 ` Wolfram Sang 0 siblings, 0 replies; 2+ messages in thread From: Wolfram Sang @ 2012-07-09 11:14 UTC (permalink / raw) To: Marc Kleine-Budde Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, kernel-bIcnvbaLZ9MEGnE8C9+IrQ [-- Attachment #1: Type: text/plain, Size: 1787 bytes --] On Sun, Jul 01, 2012 at 11:34:30PM +0200, Marc Kleine-Budde wrote: > This patch mutes the false positive compiler warning: > > drivers/i2c/busses/i2c-mxs.c: In function 'mxs_i2c_xfer_msg': > drivers/i2c/busses/i2c-mxs.c:206:8: warning: 'data' may be used uninitialized in this function [-Wuninitialized] > drivers/i2c/busses/i2c-mxs.c:196:6: note: 'data' was declared here > > Cc: "Wolfram Sang" <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> FYI: Checkpatch complains about the position of the quotes above. > Signed-off-by: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> Applied. I didn't know the exact intention of 'uninitialized_var' before. Its commit message (9490991482a2091a828d997adbc088e24c310a4d) convinces me to accept this compromise. It will silence the warning, but it can be disabled if such warnings want to be seen. Also, there is no extra code added like with '= 0'. I still do think however, gcc should be able to find out what happens. There is no pointer magic involved here... > --- > drivers/i2c/busses/i2c-mxs.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c > index 04eb441..02ce1fa 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 uninitialized_var(data); > int i; > > for (i = 0; i < len; i++) { > -- > 1.7.10 > -- 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] 2+ messages in thread
end of thread, other threads:[~2012-07-09 11:14 UTC | newest] Thread overview: 2+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-07-01 21:34 [PATCH] i2c: mxs: mxs_i2c_finish_read: mute flase positive uninitialized var Marc Kleine-Budde [not found] ` <1341178470-14904-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 2012-07-09 11:14 ` Wolfram Sang
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).