diff options
Diffstat (limited to 'sound/soc/codecs/tlv320aic3x.c')
-rw-r--r-- | sound/soc/codecs/tlv320aic3x.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index b1dce5f459db..5f9abb199435 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c | |||
@@ -1199,10 +1199,9 @@ static int aic3x_codec_probe(struct i2c_adapter *adap, int addr, int kind) | |||
1199 | client_template.addr = addr; | 1199 | client_template.addr = addr; |
1200 | 1200 | ||
1201 | i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL); | 1201 | i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL); |
1202 | if (i2c == NULL) { | 1202 | if (i2c == NULL) |
1203 | kfree(codec); | ||
1204 | return -ENOMEM; | 1203 | return -ENOMEM; |
1205 | } | 1204 | |
1206 | i2c_set_clientdata(i2c, codec); | 1205 | i2c_set_clientdata(i2c, codec); |
1207 | codec->control_data = i2c; | 1206 | codec->control_data = i2c; |
1208 | 1207 | ||
@@ -1221,7 +1220,6 @@ static int aic3x_codec_probe(struct i2c_adapter *adap, int addr, int kind) | |||
1221 | return ret; | 1220 | return ret; |
1222 | 1221 | ||
1223 | err: | 1222 | err: |
1224 | kfree(codec); | ||
1225 | kfree(i2c); | 1223 | kfree(i2c); |
1226 | return ret; | 1224 | return ret; |
1227 | } | 1225 | } |
@@ -1302,6 +1300,11 @@ static int aic3x_probe(struct platform_device *pdev) | |||
1302 | #else | 1300 | #else |
1303 | /* Add other interfaces here */ | 1301 | /* Add other interfaces here */ |
1304 | #endif | 1302 | #endif |
1303 | |||
1304 | if (ret != 0) { | ||
1305 | kfree(codec->private_data); | ||
1306 | kfree(codec); | ||
1307 | } | ||
1305 | return ret; | 1308 | return ret; |
1306 | } | 1309 | } |
1307 | 1310 | ||