Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: lp3972: Silence uninitialized variable warning

This is harmless but my static checker complains that "tmp" is
uninitialized if lp3972_i2c_read() fails. I have moved the line of code
below the error handling to silence the warning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Dan Carpenter and committed by
Mark Brown
7cb7348f f55532a0

+1 -1
+1 -1
drivers/regulator/lp3972.c
··· 211 211 mutex_lock(&lp3972->io_lock); 212 212 213 213 ret = lp3972_i2c_read(lp3972->i2c, reg, 1, &tmp); 214 - tmp = (tmp & ~mask) | val; 215 214 if (ret == 0) { 215 + tmp = (tmp & ~mask) | val; 216 216 ret = lp3972_i2c_write(lp3972->i2c, reg, 1, &tmp); 217 217 dev_dbg(lp3972->dev, "reg write 0x%02x -> 0x%02x\n", (int)reg, 218 218 (unsigned)val & 0xff);