Commit b9b50363e6c60d471fe2e71e48d434aad58b3749

Authored by Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ALSA: ASoC: Fix double free and memory leak in many codec drivers
  ALSA: CA0106 on MSI K8N Diamond PLUS Motherboard

Showing 9 changed files Side-by-side Diff

sound/pci/ca0106/ca0106_main.c
... ... @@ -249,11 +249,12 @@
249 249 .name = "MSI K8N Diamond MB [SB0438]",
250 250 .gpio_type = 2,
251 251 .i2c_adc = 1 } ,
252   - /* Another MSI K8N Diamond MB, which has apprently a different SSID */
  252 + /* MSI K8N Diamond PLUS MB */
253 253 { .serial = 0x10091102,
254 254 .name = "MSI K8N Diamond MB",
255 255 .gpio_type = 2,
256   - .i2c_adc = 1 } ,
  256 + .i2c_adc = 1,
  257 + .spi_dac = 2 }
257 258 /* Shuttle XPC SD31P which has an onboard Creative Labs
258 259 * Sound Blaster Live! 24-bit EAX
259 260 * high-definition 7.1 audio processor".
sound/soc/codecs/ak4535.c
... ... @@ -562,10 +562,9 @@
562 562 client_template.addr = addr;
563 563  
564 564 i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
565   - if (i2c == NULL) {
566   - kfree(codec);
  565 + if (i2c == NULL)
567 566 return -ENOMEM;
568   - }
  567 +
569 568 i2c_set_clientdata(i2c, codec);
570 569 codec->control_data = i2c;
571 570  
... ... @@ -583,7 +582,6 @@
583 582 return ret;
584 583  
585 584 err:
586   - kfree(codec);
587 585 kfree(i2c);
588 586 return ret;
589 587 }
... ... @@ -660,6 +658,11 @@
660 658 #else
661 659 /* Add other interfaces here */
662 660 #endif
  661 +
  662 + if (ret != 0) {
  663 + kfree(codec->private_data);
  664 + kfree(codec);
  665 + }
663 666 return ret;
664 667 }
665 668  
sound/soc/codecs/tlv320aic3x.c
... ... @@ -1199,10 +1199,9 @@
1199 1199 client_template.addr = addr;
1200 1200  
1201 1201 i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
1202   - if (i2c == NULL) {
1203   - kfree(codec);
  1202 + if (i2c == NULL)
1204 1203 return -ENOMEM;
1205   - }
  1204 +
1206 1205 i2c_set_clientdata(i2c, codec);
1207 1206 codec->control_data = i2c;
1208 1207  
... ... @@ -1221,7 +1220,6 @@
1221 1220 return ret;
1222 1221  
1223 1222 err:
1224   - kfree(codec);
1225 1223 kfree(i2c);
1226 1224 return ret;
1227 1225 }
... ... @@ -1302,6 +1300,11 @@
1302 1300 #else
1303 1301 /* Add other interfaces here */
1304 1302 #endif
  1303 +
  1304 + if (ret != 0) {
  1305 + kfree(codec->private_data);
  1306 + kfree(codec);
  1307 + }
1305 1308 return ret;
1306 1309 }
1307 1310  
sound/soc/codecs/uda1380.c
... ... @@ -729,10 +729,9 @@
729 729 client_template.addr = addr;
730 730  
731 731 i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
732   - if (i2c == NULL) {
733   - kfree(codec);
  732 + if (i2c == NULL)
734 733 return -ENOMEM;
735   - }
  734 +
736 735 i2c_set_clientdata(i2c, codec);
737 736 codec->control_data = i2c;
738 737  
... ... @@ -750,7 +749,6 @@
750 749 return ret;
751 750  
752 751 err:
753   - kfree(codec);
754 752 kfree(i2c);
755 753 return ret;
756 754 }
... ... @@ -817,6 +815,9 @@
817 815 #else
818 816 /* Add other interfaces here */
819 817 #endif
  818 +
  819 + if (ret != 0)
  820 + kfree(codec);
820 821 return ret;
821 822 }
822 823  
sound/soc/codecs/wm8510.c
... ... @@ -693,10 +693,9 @@
693 693 client_template.addr = addr;
694 694  
695 695 i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
696   - if (i2c == NULL) {
697   - kfree(codec);
  696 + if (i2c == NULL)
698 697 return -ENOMEM;
699   - }
  698 +
700 699 i2c_set_clientdata(i2c, codec);
701 700 codec->control_data = i2c;
702 701  
... ... @@ -714,7 +713,6 @@
714 713 return ret;
715 714  
716 715 err:
717   - kfree(codec);
718 716 kfree(i2c);
719 717 return ret;
720 718 }
... ... @@ -782,6 +780,9 @@
782 780 #else
783 781 /* Add other interfaces here */
784 782 #endif
  783 +
  784 + if (ret != 0)
  785 + kfree(codec);
785 786 return ret;
786 787 }
787 788  
sound/soc/codecs/wm8731.c
... ... @@ -596,10 +596,9 @@
596 596 client_template.addr = addr;
597 597  
598 598 i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
599   - if (i2c == NULL) {
600   - kfree(codec);
  599 + if (i2c == NULL)
601 600 return -ENOMEM;
602   - }
  601 +
603 602 i2c_set_clientdata(i2c, codec);
604 603 codec->control_data = i2c;
605 604  
... ... @@ -617,7 +616,6 @@
617 616 return ret;
618 617  
619 618 err:
620   - kfree(codec);
621 619 kfree(i2c);
622 620 return ret;
623 621 }
... ... @@ -693,6 +691,11 @@
693 691 #else
694 692 /* Add other interfaces here */
695 693 #endif
  694 +
  695 + if (ret != 0) {
  696 + kfree(codec->private_data);
  697 + kfree(codec);
  698 + }
696 699 return ret;
697 700 }
698 701  
sound/soc/codecs/wm8750.c
... ... @@ -869,10 +869,9 @@
869 869 client_template.addr = addr;
870 870  
871 871 i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
872   - if (i2c == NULL) {
873   - kfree(codec);
  872 + if (i2c == NULL)
874 873 return -ENOMEM;
875   - }
  874 +
876 875 i2c_set_clientdata(i2c, codec);
877 876 codec->control_data = i2c;
878 877  
... ... @@ -890,7 +889,6 @@
890 889 return ret;
891 890  
892 891 err:
893   - kfree(codec);
894 892 kfree(i2c);
895 893 return ret;
896 894 }
... ... @@ -966,6 +964,10 @@
966 964 /* Add other interfaces here */
967 965 #endif
968 966  
  967 + if (ret != 0) {
  968 + kfree(codec->private_data);
  969 + kfree(codec);
  970 + }
969 971 return ret;
970 972 }
971 973  
sound/soc/codecs/wm8753.c
... ... @@ -1660,10 +1660,9 @@
1660 1660 client_template.addr = addr;
1661 1661  
1662 1662 i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
1663   - if (!i2c) {
1664   - kfree(codec);
  1663 + if (!i2c)
1665 1664 return -ENOMEM;
1666   - }
  1665 +
1667 1666 i2c_set_clientdata(i2c, codec);
1668 1667 codec->control_data = i2c;
1669 1668  
... ... @@ -1682,7 +1681,6 @@
1682 1681 return ret;
1683 1682  
1684 1683 err:
1685   - kfree(codec);
1686 1684 kfree(i2c);
1687 1685 return ret;
1688 1686 }
... ... @@ -1759,6 +1757,11 @@
1759 1757 #else
1760 1758 /* Add other interfaces here */
1761 1759 #endif
  1760 +
  1761 + if (ret != 0) {
  1762 + kfree(codec->private_data);
  1763 + kfree(codec);
  1764 + }
1762 1765 return ret;
1763 1766 }
1764 1767  
sound/soc/codecs/wm8990.c
... ... @@ -1500,10 +1500,9 @@
1500 1500 client_template.addr = addr;
1501 1501  
1502 1502 i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
1503   - if (i2c == NULL) {
1504   - kfree(codec);
  1503 + if (i2c == NULL)
1505 1504 return -ENOMEM;
1506   - }
  1505 +
1507 1506 i2c_set_clientdata(i2c, codec);
1508 1507 codec->control_data = i2c;
1509 1508  
... ... @@ -1521,7 +1520,6 @@
1521 1520 return ret;
1522 1521  
1523 1522 err:
1524   - kfree(codec);
1525 1523 kfree(i2c);
1526 1524 return ret;
1527 1525 }
... ... @@ -1595,6 +1593,11 @@
1595 1593 #else
1596 1594 /* Add other interfaces here */
1597 1595 #endif
  1596 +
  1597 + if (ret != 0) {
  1598 + kfree(codec->private_data);
  1599 + kfree(codec);
  1600 + }
1598 1601 return ret;
1599 1602 }
1600 1603