aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/ak4535.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/ak4535.c')
-rw-r--r--sound/soc/codecs/ak4535.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c
index b26003c4f3e8..7da9f467b7b8 100644
--- a/sound/soc/codecs/ak4535.c
+++ b/sound/soc/codecs/ak4535.c
@@ -562,10 +562,9 @@ static int ak4535_codec_probe(struct i2c_adapter *adap, int addr, int kind)
562 client_template.addr = addr; 562 client_template.addr = addr;
563 563
564 i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL); 564 i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
565 if (i2c == NULL) { 565 if (i2c == NULL)
566 kfree(codec);
567 return -ENOMEM; 566 return -ENOMEM;
568 } 567
569 i2c_set_clientdata(i2c, codec); 568 i2c_set_clientdata(i2c, codec);
570 codec->control_data = i2c; 569 codec->control_data = i2c;
571 570
@@ -583,7 +582,6 @@ static int ak4535_codec_probe(struct i2c_adapter *adap, int addr, int kind)
583 return ret; 582 return ret;
584 583
585err: 584err:
586 kfree(codec);
587 kfree(i2c); 585 kfree(i2c);
588 return ret; 586 return ret;
589} 587}
@@ -660,6 +658,11 @@ static int ak4535_probe(struct platform_device *pdev)
660#else 658#else
661 /* Add other interfaces here */ 659 /* Add other interfaces here */
662#endif 660#endif
661
662 if (ret != 0) {
663 kfree(codec->private_data);
664 kfree(codec);
665 }
663 return ret; 666 return ret;
664} 667}
665 668