소스 검색

ASoC: Convert tpa6130a2 to devm_kzalloc()

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin 14 년 전
부모
커밋
6945e9f9df
1개의 변경된 파일1개의 추가작업 그리고 4개의 파일을 삭제
  1. 1 4
      sound/soc/codecs/tpa6130a2.c

+ 1 - 4
sound/soc/codecs/tpa6130a2.c

@@ -376,7 +376,7 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client,
 		return -ENODEV;
 		return -ENODEV;
 	}
 	}
 
 
-	data = kzalloc(sizeof(*data), GFP_KERNEL);
+	data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
 	if (data == NULL) {
 	if (data == NULL) {
 		dev_err(dev, "Can not allocate memory\n");
 		dev_err(dev, "Can not allocate memory\n");
 		return -ENOMEM;
 		return -ENOMEM;
@@ -450,7 +450,6 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client,
 	if (data->power_gpio >= 0)
 	if (data->power_gpio >= 0)
 		gpio_free(data->power_gpio);
 		gpio_free(data->power_gpio);
 err_gpio:
 err_gpio:
-	kfree(data);
 	tpa6130a2_client = NULL;
 	tpa6130a2_client = NULL;
 
 
 	return ret;
 	return ret;
@@ -466,8 +465,6 @@ static int __devexit tpa6130a2_remove(struct i2c_client *client)
 		gpio_free(data->power_gpio);
 		gpio_free(data->power_gpio);
 
 
 	regulator_put(data->supply);
 	regulator_put(data->supply);
-
-	kfree(data);
 	tpa6130a2_client = NULL;
 	tpa6130a2_client = NULL;
 
 
 	return 0;
 	return 0;