Skip to content

Commit

Permalink
gcc-9: don't warn about uninitialized variable
Browse files Browse the repository at this point in the history
I'm not sure what made gcc warn about this code now.  The 'ret' variable
does end up initialized in all cases, but it's definitely not obvious,
so the compiler is quite reasonable to warn about this.

So just add initialization to make it all much more obvious both to
compilers and to humans.

Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
torvalds committed May 1, 2019
1 parent 6f303d6 commit cf67690
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/i2c/i2c-core-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ static int i2c_generic_bus_free(struct i2c_adapter *adap)
int i2c_generic_scl_recovery(struct i2c_adapter *adap)
{
struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
int i = 0, scl = 1, ret;
int i = 0, scl = 1, ret = 0;

if (bri->prepare_recovery)
bri->prepare_recovery(adap);
Expand Down

0 comments on commit cf67690

Please sign in to comment.