[alsa-devel] [PATCH 1/5] ASoC: Convert ak4104 to devm_kzalloc()
Signed-off-by: Axel Lin axel.lin@gmail.com --- sound/soc/codecs/ak4104.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/ak4104.c b/sound/soc/codecs/ak4104.c index 152420c..d27b5e4 100644 --- a/sound/soc/codecs/ak4104.c +++ b/sound/soc/codecs/ak4104.c @@ -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; }
Signed-off-by: Axel Lin axel.lin@gmail.com --- sound/soc/codecs/ak4535.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c index 96296fd..9e809e0 100644 --- a/sound/soc/codecs/ak4535.c +++ b/sound/soc/codecs/ak4535.c @@ -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; }
Signed-off-by: Axel Lin axel.lin@gmail.com --- sound/soc/codecs/ak4641.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c index 9018470..266ebea 100644 --- a/sound/soc/codecs/ak4641.c +++ b/sound/soc/codecs/ak4641.c @@ -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; }
Signed-off-by: Axel Lin axel.lin@gmail.com --- sound/soc/codecs/ak4642.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index 9b4ee6c..5ef70b5 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -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; }
Signed-off-by: Axel Lin axel.lin@gmail.com --- sound/soc/codecs/ak4671.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/ak4671.c b/sound/soc/codecs/ak4671.c index 4f5c69f..a53b152 100644 --- a/sound/soc/codecs/ak4671.c +++ b/sound/soc/codecs/ak4671.c @@ -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; }
participants (1)
-
Axel Lin