diff options
Diffstat (limited to 'sound/soc/codecs/wm8753.c')
-rw-r--r-- | sound/soc/codecs/wm8753.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index dc7b18fd2782..5761164fe16d 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c | |||
@@ -1660,10 +1660,9 @@ static int wm8753_codec_probe(struct i2c_adapter *adap, int addr, int kind) | |||
1660 | client_template.addr = addr; | 1660 | client_template.addr = addr; |
1661 | 1661 | ||
1662 | i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL); | 1662 | i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL); |
1663 | if (!i2c) { | 1663 | if (!i2c) |
1664 | kfree(codec); | ||
1665 | return -ENOMEM; | 1664 | return -ENOMEM; |
1666 | } | 1665 | |
1667 | i2c_set_clientdata(i2c, codec); | 1666 | i2c_set_clientdata(i2c, codec); |
1668 | codec->control_data = i2c; | 1667 | codec->control_data = i2c; |
1669 | 1668 | ||
@@ -1682,7 +1681,6 @@ static int wm8753_codec_probe(struct i2c_adapter *adap, int addr, int kind) | |||
1682 | return ret; | 1681 | return ret; |
1683 | 1682 | ||
1684 | err: | 1683 | err: |
1685 | kfree(codec); | ||
1686 | kfree(i2c); | 1684 | kfree(i2c); |
1687 | return ret; | 1685 | return ret; |
1688 | } | 1686 | } |
@@ -1759,6 +1757,11 @@ static int wm8753_probe(struct platform_device *pdev) | |||
1759 | #else | 1757 | #else |
1760 | /* Add other interfaces here */ | 1758 | /* Add other interfaces here */ |
1761 | #endif | 1759 | #endif |
1760 | |||
1761 | if (ret != 0) { | ||
1762 | kfree(codec->private_data); | ||
1763 | kfree(codec); | ||
1764 | } | ||
1762 | return ret; | 1765 | return ret; |
1763 | } | 1766 | } |
1764 | 1767 | ||