Skip to content

Commit 6977262

Browse files
nathanchancewsakernel
authored andcommitted
i2c: at91: Initialize dma_buf in at91_twi_xfer()
Clang warns: drivers/i2c/busses/i2c-at91-master.c:707:6: warning: variable 'dma_buf' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (dev->use_dma) { ^~~~~~~~~~~~ drivers/i2c/busses/i2c-at91-master.c:717:27: note: uninitialized use occurs here i2c_put_dma_safe_msg_buf(dma_buf, m_start, !ret); ^~~~~~~ Initialize dma_buf to NULL, as i2c_put_dma_safe_msg_buf() is a no-op when the first argument is NULL, which will work for the !dev->use_dma case. Fixes: 03fbb90 ("i2c: at91: use dma safe buffers") Link: ClangBuiltLinux#1629 Signed-off-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Michael Walle <michael@walle.cc> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent a181b8d commit 6977262

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/i2c/busses/i2c-at91-master.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ static int at91_twi_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, int num)
656656
unsigned int_addr_flag = 0;
657657
struct i2c_msg *m_start = msg;
658658
bool is_read;
659-
u8 *dma_buf;
659+
u8 *dma_buf = NULL;
660660

661661
dev_dbg(&adap->dev, "at91_xfer: processing %d messages:\n", num);
662662

0 commit comments

Comments
 (0)