diff options
Diffstat (limited to 'sound/soc/codecs/wm8510.c')
| -rw-r--r-- | sound/soc/codecs/wm8510.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c index 67325fd95447..3d998e6a997e 100644 --- a/sound/soc/codecs/wm8510.c +++ b/sound/soc/codecs/wm8510.c | |||
| @@ -693,10 +693,9 @@ static int wm8510_codec_probe(struct i2c_adapter *adap, int addr, int kind) | |||
| 693 | client_template.addr = addr; | 693 | client_template.addr = addr; |
| 694 | 694 | ||
| 695 | i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL); | 695 | i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL); |
| 696 | if (i2c == NULL) { | 696 | if (i2c == NULL) |
| 697 | kfree(codec); | ||
| 698 | return -ENOMEM; | 697 | return -ENOMEM; |
| 699 | } | 698 | |
| 700 | i2c_set_clientdata(i2c, codec); | 699 | i2c_set_clientdata(i2c, codec); |
| 701 | codec->control_data = i2c; | 700 | codec->control_data = i2c; |
| 702 | 701 | ||
| @@ -714,7 +713,6 @@ static int wm8510_codec_probe(struct i2c_adapter *adap, int addr, int kind) | |||
| 714 | return ret; | 713 | return ret; |
| 715 | 714 | ||
| 716 | err: | 715 | err: |
| 717 | kfree(codec); | ||
| 718 | kfree(i2c); | 716 | kfree(i2c); |
| 719 | return ret; | 717 | return ret; |
| 720 | } | 718 | } |
| @@ -782,6 +780,9 @@ static int wm8510_probe(struct platform_device *pdev) | |||
| 782 | #else | 780 | #else |
| 783 | /* Add other interfaces here */ | 781 | /* Add other interfaces here */ |
| 784 | #endif | 782 | #endif |
| 783 | |||
| 784 | if (ret != 0) | ||
| 785 | kfree(codec); | ||
| 785 | return ret; | 786 | return ret; |
| 786 | } | 787 | } |
| 787 | 788 | ||
