diff options
Diffstat (limited to 'sound/soc/codecs/wm8731.c')
-rw-r--r-- | sound/soc/codecs/wm8731.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index 369d39c3f745..9402fcaf04fa 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c | |||
@@ -596,10 +596,9 @@ static int wm8731_codec_probe(struct i2c_adapter *adap, int addr, int kind) | |||
596 | client_template.addr = addr; | 596 | client_template.addr = addr; |
597 | 597 | ||
598 | i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL); | 598 | i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL); |
599 | if (i2c == NULL) { | 599 | if (i2c == NULL) |
600 | kfree(codec); | ||
601 | return -ENOMEM; | 600 | return -ENOMEM; |
602 | } | 601 | |
603 | i2c_set_clientdata(i2c, codec); | 602 | i2c_set_clientdata(i2c, codec); |
604 | codec->control_data = i2c; | 603 | codec->control_data = i2c; |
605 | 604 | ||
@@ -617,7 +616,6 @@ static int wm8731_codec_probe(struct i2c_adapter *adap, int addr, int kind) | |||
617 | return ret; | 616 | return ret; |
618 | 617 | ||
619 | err: | 618 | err: |
620 | kfree(codec); | ||
621 | kfree(i2c); | 619 | kfree(i2c); |
622 | return ret; | 620 | return ret; |
623 | } | 621 | } |
@@ -693,6 +691,11 @@ static int wm8731_probe(struct platform_device *pdev) | |||
693 | #else | 691 | #else |
694 | /* Add other interfaces here */ | 692 | /* Add other interfaces here */ |
695 | #endif | 693 | #endif |
694 | |||
695 | if (ret != 0) { | ||
696 | kfree(codec->private_data); | ||
697 | kfree(codec); | ||
698 | } | ||
696 | return ret; | 699 | return ret; |
697 | } | 700 | } |
698 | 701 | ||