Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/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
  • Loading branch information
torvalds committed Aug 25, 2008
2 parents 087713f + 3051e41 commit b9b5036
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 34 deletions.
5 changes: 3 additions & 2 deletions sound/pci/ca0106/ca0106_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,12 @@ static struct snd_ca0106_details ca0106_chip_details[] = {
.name = "MSI K8N Diamond MB [SB0438]",
.gpio_type = 2,
.i2c_adc = 1 } ,
/* Another MSI K8N Diamond MB, which has apprently a different SSID */
/* MSI K8N Diamond PLUS MB */
{ .serial = 0x10091102,
.name = "MSI K8N Diamond MB",
.gpio_type = 2,
.i2c_adc = 1 } ,
.i2c_adc = 1,
.spi_dac = 2 }
/* Shuttle XPC SD31P which has an onboard Creative Labs
* Sound Blaster Live! 24-bit EAX
* high-definition 7.1 audio processor".
Expand Down
11 changes: 7 additions & 4 deletions sound/soc/codecs/ak4535.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,10 +562,9 @@ static int ak4535_codec_probe(struct i2c_adapter *adap, int addr, int kind)
client_template.addr = addr;

i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
if (i2c == NULL) {
kfree(codec);
if (i2c == NULL)
return -ENOMEM;
}

i2c_set_clientdata(i2c, codec);
codec->control_data = i2c;

Expand All @@ -583,7 +582,6 @@ static int ak4535_codec_probe(struct i2c_adapter *adap, int addr, int kind)
return ret;

err:
kfree(codec);
kfree(i2c);
return ret;
}
Expand Down Expand Up @@ -660,6 +658,11 @@ static int ak4535_probe(struct platform_device *pdev)
#else
/* Add other interfaces here */
#endif

if (ret != 0) {
kfree(codec->private_data);
kfree(codec);
}
return ret;
}

Expand Down
11 changes: 7 additions & 4 deletions sound/soc/codecs/tlv320aic3x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1199,10 +1199,9 @@ static int aic3x_codec_probe(struct i2c_adapter *adap, int addr, int kind)
client_template.addr = addr;

i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
if (i2c == NULL) {
kfree(codec);
if (i2c == NULL)
return -ENOMEM;
}

i2c_set_clientdata(i2c, codec);
codec->control_data = i2c;

Expand All @@ -1221,7 +1220,6 @@ static int aic3x_codec_probe(struct i2c_adapter *adap, int addr, int kind)
return ret;

err:
kfree(codec);
kfree(i2c);
return ret;
}
Expand Down Expand Up @@ -1302,6 +1300,11 @@ static int aic3x_probe(struct platform_device *pdev)
#else
/* Add other interfaces here */
#endif

if (ret != 0) {
kfree(codec->private_data);
kfree(codec);
}
return ret;
}

Expand Down
9 changes: 5 additions & 4 deletions sound/soc/codecs/uda1380.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,10 +729,9 @@ static int uda1380_codec_probe(struct i2c_adapter *adap, int addr, int kind)
client_template.addr = addr;

i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
if (i2c == NULL) {
kfree(codec);
if (i2c == NULL)
return -ENOMEM;
}

i2c_set_clientdata(i2c, codec);
codec->control_data = i2c;

Expand All @@ -750,7 +749,6 @@ static int uda1380_codec_probe(struct i2c_adapter *adap, int addr, int kind)
return ret;

err:
kfree(codec);
kfree(i2c);
return ret;
}
Expand Down Expand Up @@ -817,6 +815,9 @@ static int uda1380_probe(struct platform_device *pdev)
#else
/* Add other interfaces here */
#endif

if (ret != 0)
kfree(codec);
return ret;
}

Expand Down
9 changes: 5 additions & 4 deletions sound/soc/codecs/wm8510.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,10 +693,9 @@ static int wm8510_codec_probe(struct i2c_adapter *adap, int addr, int kind)
client_template.addr = addr;

i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
if (i2c == NULL) {
kfree(codec);
if (i2c == NULL)
return -ENOMEM;
}

i2c_set_clientdata(i2c, codec);
codec->control_data = i2c;

Expand All @@ -714,7 +713,6 @@ static int wm8510_codec_probe(struct i2c_adapter *adap, int addr, int kind)
return ret;

err:
kfree(codec);
kfree(i2c);
return ret;
}
Expand Down Expand Up @@ -782,6 +780,9 @@ static int wm8510_probe(struct platform_device *pdev)
#else
/* Add other interfaces here */
#endif

if (ret != 0)
kfree(codec);
return ret;
}

Expand Down
11 changes: 7 additions & 4 deletions sound/soc/codecs/wm8731.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,10 +596,9 @@ static int wm8731_codec_probe(struct i2c_adapter *adap, int addr, int kind)
client_template.addr = addr;

i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
if (i2c == NULL) {
kfree(codec);
if (i2c == NULL)
return -ENOMEM;
}

i2c_set_clientdata(i2c, codec);
codec->control_data = i2c;

Expand All @@ -617,7 +616,6 @@ static int wm8731_codec_probe(struct i2c_adapter *adap, int addr, int kind)
return ret;

err:
kfree(codec);
kfree(i2c);
return ret;
}
Expand Down Expand Up @@ -693,6 +691,11 @@ static int wm8731_probe(struct platform_device *pdev)
#else
/* Add other interfaces here */
#endif

if (ret != 0) {
kfree(codec->private_data);
kfree(codec);
}
return ret;
}

Expand Down
10 changes: 6 additions & 4 deletions sound/soc/codecs/wm8750.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,10 +869,9 @@ static int wm8750_codec_probe(struct i2c_adapter *adap, int addr, int kind)
client_template.addr = addr;

i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
if (i2c == NULL) {
kfree(codec);
if (i2c == NULL)
return -ENOMEM;
}

i2c_set_clientdata(i2c, codec);
codec->control_data = i2c;

Expand All @@ -890,7 +889,6 @@ static int wm8750_codec_probe(struct i2c_adapter *adap, int addr, int kind)
return ret;

err:
kfree(codec);
kfree(i2c);
return ret;
}
Expand Down Expand Up @@ -966,6 +964,10 @@ static int wm8750_probe(struct platform_device *pdev)
/* Add other interfaces here */
#endif

if (ret != 0) {
kfree(codec->private_data);
kfree(codec);
}
return ret;
}

Expand Down
11 changes: 7 additions & 4 deletions sound/soc/codecs/wm8753.c
Original file line number Diff line number Diff line change
Expand Up @@ -1660,10 +1660,9 @@ static int wm8753_codec_probe(struct i2c_adapter *adap, int addr, int kind)
client_template.addr = addr;

i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
if (!i2c) {
kfree(codec);
if (!i2c)
return -ENOMEM;
}

i2c_set_clientdata(i2c, codec);
codec->control_data = i2c;

Expand All @@ -1682,7 +1681,6 @@ static int wm8753_codec_probe(struct i2c_adapter *adap, int addr, int kind)
return ret;

err:
kfree(codec);
kfree(i2c);
return ret;
}
Expand Down Expand Up @@ -1759,6 +1757,11 @@ static int wm8753_probe(struct platform_device *pdev)
#else
/* Add other interfaces here */
#endif

if (ret != 0) {
kfree(codec->private_data);
kfree(codec);
}
return ret;
}

Expand Down
11 changes: 7 additions & 4 deletions sound/soc/codecs/wm8990.c
Original file line number Diff line number Diff line change
Expand Up @@ -1500,10 +1500,9 @@ static int wm8990_codec_probe(struct i2c_adapter *adap, int addr, int kind)
client_template.addr = addr;

i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
if (i2c == NULL) {
kfree(codec);
if (i2c == NULL)
return -ENOMEM;
}

i2c_set_clientdata(i2c, codec);
codec->control_data = i2c;

Expand All @@ -1521,7 +1520,6 @@ static int wm8990_codec_probe(struct i2c_adapter *adap, int addr, int kind)
return ret;

err:
kfree(codec);
kfree(i2c);
return ret;
}
Expand Down Expand Up @@ -1595,6 +1593,11 @@ static int wm8990_probe(struct platform_device *pdev)
#else
/* Add other interfaces here */
#endif

if (ret != 0) {
kfree(codec->private_data);
kfree(codec);
}
return ret;
}

Expand Down

0 comments on commit b9b5036

Please sign in to comment.