Commit 5150c802 authored by Gerd Knorr's avatar Gerd Knorr Committed by Linus Torvalds

[PATCH] msp3400 fix

The patch below fixes a minor memory leak (forgotten kfree() on
initialization errors) in the msp3400 module.
parent effdd2b7
...@@ -1266,6 +1266,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, ...@@ -1266,6 +1266,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr,
if (-1 == msp3400c_reset(c)) { if (-1 == msp3400c_reset(c)) {
kfree(msp); kfree(msp);
kfree(c);
dprintk("msp3400: no chip found\n"); dprintk("msp3400: no chip found\n");
return -1; return -1;
} }
...@@ -1275,6 +1276,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, ...@@ -1275,6 +1276,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr,
rev2 = msp3400c_read(c, I2C_MSP3400C_DFP, 0x1f); rev2 = msp3400c_read(c, I2C_MSP3400C_DFP, 0x1f);
if ((-1 == rev1) || (0 == rev1 && 0 == rev2)) { if ((-1 == rev1) || (0 == rev1 && 0 == rev2)) {
kfree(msp); kfree(msp);
kfree(c);
printk("msp3400: error while reading chip version\n"); printk("msp3400: error while reading chip version\n");
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment