i2c: mxs: mxs_i2c_finish_read: mute flase positive uninitialized var
Subsystems (2)
PATCH 1/1 i2c: mxs: mxs_i2c_finish_read: mute flase positive uninitialized var
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
--- drivers/i2c/busses/i2c-mxs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-mxs.c +1 -1
@@ -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++) {
Signature · 1 line
1.7.10
PATCH 1/1 i2c: mxs: mxs_i2c_finish_read: mute flase positive uninitialized var
Quoted 7 lines · Marc Kleine-Budde
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 hereCc "Wolfram Sang" <[email protected]>
FYI: Checkpatch complains about the position of the quotes above.
Quoted 1 line
Signed-off-by Marc Kleine-Budde <[email protected]>
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...
Quoted 20 lines
--- drivers/i2c/busses/i2c-mxs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/i2c/busses/i2c-mxs.c +1
-1@@ -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++) {Signature · 1 line
1.7.10
Signature · 9 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120709/ddcd158c/attachment.sig>