Skip to contentSkip to conversation

ASoC: Convert ak4104 to devm_kzalloc()

PATCH New Axel Lin 1 participant 5 messages Dec 20, 2011

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/5 ASoC: Convert ak4104 to devm_kzalloc()

---
 sound/soc/codecs/ak4104.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
sound/soc/codecs/ak4104.c +2 -4
index 152420c..d27b5e4 100644
@@ -261,7 +261,8 @@ static int ak4104_spi_probe(struct spi_device *spi)
 	if (ret < 0)
 		return ret;
 
-	ak4104 = kzalloc(sizeof(struct ak4104_private), GFP_KERNEL);
+	ak4104 = devm_kzalloc(&spi->dev, sizeof(struct ak4104_private),
+			      GFP_KERNEL);
 	if (ak4104 == NULL)
 		return -ENOMEM;
 
@@ -271,15 +272,12 @@ static int ak4104_spi_probe(struct spi_device *spi)
 
 	ret = snd_soc_register_codec(&spi->dev,
 			&soc_codec_device_ak4104, &ak4104_dai, 1);
-	if (ret < 0)
-		kfree(ak4104);
 	return ret;
 }
 
 static int __devexit ak4104_spi_remove(struct spi_device *spi)
 {
 	snd_soc_unregister_codec(&spi->dev);
-	kfree(spi_get_drvdata(spi));
 	return 0;
 }
 
Signature · 1 line
1.7.5.4
author
#1 lore raw

PATCH 2/5 ASoC: Convert ak4535 to devm_kzalloc()

---
 sound/soc/codecs/ak4535.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
sound/soc/codecs/ak4535.c +2 -4
index 96296fd..9e809e0 100644
@@ -416,7 +416,8 @@ static __devinit int ak4535_i2c_probe(struct i2c_client *i2c,
 	struct ak4535_priv *ak4535;
 	int ret;
 
-	ak4535 = kzalloc(sizeof(struct ak4535_priv), GFP_KERNEL);
+	ak4535 = devm_kzalloc(&i2c->dev, sizeof(struct ak4535_priv),
+			      GFP_KERNEL);
 	if (ak4535 == NULL)
 		return -ENOMEM;
 
@@ -425,15 +426,12 @@ static __devinit int ak4535_i2c_probe(struct i2c_client *i2c,
 
 	ret = snd_soc_register_codec(&i2c->dev,
 			&soc_codec_dev_ak4535, &ak4535_dai, 1);
-	if (ret < 0)
-		kfree(ak4535);
 	return ret;
 }
 
 static __devexit int ak4535_i2c_remove(struct i2c_client *client)
 {
 	snd_soc_unregister_codec(&client->dev);
-	kfree(i2c_get_clientdata(client));
 	return 0;
 }
 
Signature · 1 line
1.7.5.4
author
#2 lore raw

PATCH 3/5 ASoC: Convert ak4641 to devm_kzalloc()

In reply to Axel Lin
---
 sound/soc/codecs/ak4641.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
sound/soc/codecs/ak4641.c +2 -5
index 9018470..266ebea 100644
@@ -602,7 +602,8 @@ static int __devinit ak4641_i2c_probe(struct i2c_client *i2c,
 	struct ak4641_priv *ak4641;
 	int ret;
 
-	ak4641 = kzalloc(sizeof(struct ak4641_priv), GFP_KERNEL);
+	ak4641 = devm_kzalloc(&i2c->dev, sizeof(struct ak4641_priv),
+			      GFP_KERNEL);
 	if (!ak4641)
 		return -ENOMEM;
 
@@ -610,16 +611,12 @@ static int __devinit ak4641_i2c_probe(struct i2c_client *i2c,
 
 	ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_ak4641,
 				ak4641_dai, ARRAY_SIZE(ak4641_dai));
-	if (ret < 0)
-		kfree(ak4641);
-
 	return ret;
 }
 
 static int __devexit ak4641_i2c_remove(struct i2c_client *i2c)
 {
 	snd_soc_unregister_codec(&i2c->dev);
-	kfree(i2c_get_clientdata(i2c));
 	return 0;
 }
 
Signature · 1 line
1.7.5.4
author
#3 lore raw

PATCH 4/5 ASoC: Convert ak4642 to devm_kzalloc()

In reply to Axel Lin
---
 sound/soc/codecs/ak4642.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
sound/soc/codecs/ak4642.c +2 -4
index 9b4ee6c..5ef70b5 100644
@@ -525,7 +525,8 @@ static __devinit int ak4642_i2c_probe(struct i2c_client *i2c,
 	struct ak4642_priv *ak4642;
 	int ret;
 
-	ak4642 = kzalloc(sizeof(struct ak4642_priv), GFP_KERNEL);
+	ak4642 = devm_kzalloc(&i2c->dev, sizeof(struct ak4642_priv),
+			      GFP_KERNEL);
 	if (!ak4642)
 		return -ENOMEM;
 
@@ -535,15 +536,12 @@ static __devinit int ak4642_i2c_probe(struct i2c_client *i2c,
 	ret =  snd_soc_register_codec(&i2c->dev,
 				(struct snd_soc_codec_driver *)id->driver_data,
 				&ak4642_dai, 1);
-	if (ret < 0)
-		kfree(ak4642);
 	return ret;
 }
 
 static __devexit int ak4642_i2c_remove(struct i2c_client *client)
 {
 	snd_soc_unregister_codec(&client->dev);
-	kfree(i2c_get_clientdata(client));
 	return 0;
 }
 
Signature · 1 line
1.7.5.4
author
#4 lore raw

PATCH 5/5 ASoC: Convert ak4671 to devm_kzalloc()

In reply to Axel Lin
---
 sound/soc/codecs/ak4671.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
sound/soc/codecs/ak4671.c +2 -4
index 4f5c69f..a53b152 100644
@@ -661,7 +661,8 @@ static int __devinit ak4671_i2c_probe(struct i2c_client *client,
 	struct ak4671_priv *ak4671;
 	int ret;
 
-	ak4671 = kzalloc(sizeof(struct ak4671_priv), GFP_KERNEL);
+	ak4671 = devm_kzalloc(&client->dev, sizeof(struct ak4671_priv),
+			      GFP_KERNEL);
 	if (ak4671 == NULL)
 		return -ENOMEM;
 
@@ -670,15 +671,12 @@ static int __devinit ak4671_i2c_probe(struct i2c_client *client,
 
 	ret = snd_soc_register_codec(&client->dev,
 			&soc_codec_dev_ak4671, &ak4671_dai, 1);
-	if (ret < 0)
-		kfree(ak4671);
 	return ret;
 }
 
 static __devexit int ak4671_i2c_remove(struct i2c_client *client)
 {
 	snd_soc_unregister_codec(&client->dev);
-	kfree(i2c_get_clientdata(client));
 	return 0;
 }
 
Signature · 1 line
1.7.5.4