diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-12-03 15:30:37 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-12-07 10:56:50 -0500 |
commit | b960ce74a70477d7d7d3c08669a8f0f52017b4fa (patch) | |
tree | 734f717e34327c97596b005d47ca118abe4adbc2 /sound/soc/samsung | |
parent | f18b4e2ee9649c4aa50cc279826d3890f468a80e (diff) |
ASoC: Convert Samsung I2S driver to devm_kzalloc()
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Sangbeom Kim <sbkim73@samsung.com>
Diffstat (limited to 'sound/soc/samsung')
-rw-r--r-- | sound/soc/samsung/i2s.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 5de500ce5dd4..ff5d9194d11f 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c | |||
@@ -945,7 +945,7 @@ struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) | |||
945 | { | 945 | { |
946 | struct i2s_dai *i2s; | 946 | struct i2s_dai *i2s; |
947 | 947 | ||
948 | i2s = kzalloc(sizeof(struct i2s_dai), GFP_KERNEL); | 948 | i2s = devm_kzalloc(&pdev->dev, sizeof(struct i2s_dai), GFP_KERNEL); |
949 | if (i2s == NULL) | 949 | if (i2s == NULL) |
950 | return NULL; | 950 | return NULL; |
951 | 951 | ||
@@ -972,10 +972,8 @@ struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) | |||
972 | i2s->pdev = platform_device_register_resndata(NULL, | 972 | i2s->pdev = platform_device_register_resndata(NULL, |
973 | pdev->name, pdev->id + SAMSUNG_I2S_SECOFF, | 973 | pdev->name, pdev->id + SAMSUNG_I2S_SECOFF, |
974 | NULL, 0, NULL, 0); | 974 | NULL, 0, NULL, 0); |
975 | if (IS_ERR(i2s->pdev)) { | 975 | if (IS_ERR(i2s->pdev)) |
976 | kfree(i2s); | ||
977 | return NULL; | 976 | return NULL; |
978 | } | ||
979 | } | 977 | } |
980 | 978 | ||
981 | /* Pre-assign snd_soc_dai_set_drvdata */ | 979 | /* Pre-assign snd_soc_dai_set_drvdata */ |
@@ -1048,7 +1046,7 @@ static __devinit int samsung_i2s_probe(struct platform_device *pdev) | |||
1048 | if (!pri_dai) { | 1046 | if (!pri_dai) { |
1049 | dev_err(&pdev->dev, "Unable to alloc I2S_pri\n"); | 1047 | dev_err(&pdev->dev, "Unable to alloc I2S_pri\n"); |
1050 | ret = -ENOMEM; | 1048 | ret = -ENOMEM; |
1051 | goto err1; | 1049 | goto err; |
1052 | } | 1050 | } |
1053 | 1051 | ||
1054 | pri_dai->dma_playback.dma_addr = regs_base + I2STXD; | 1052 | pri_dai->dma_playback.dma_addr = regs_base + I2STXD; |
@@ -1073,7 +1071,7 @@ static __devinit int samsung_i2s_probe(struct platform_device *pdev) | |||
1073 | if (!sec_dai) { | 1071 | if (!sec_dai) { |
1074 | dev_err(&pdev->dev, "Unable to alloc I2S_sec\n"); | 1072 | dev_err(&pdev->dev, "Unable to alloc I2S_sec\n"); |
1075 | ret = -ENOMEM; | 1073 | ret = -ENOMEM; |
1076 | goto err2; | 1074 | goto err; |
1077 | } | 1075 | } |
1078 | sec_dai->dma_playback.dma_addr = regs_base + I2STXDS; | 1076 | sec_dai->dma_playback.dma_addr = regs_base + I2STXDS; |
1079 | sec_dai->dma_playback.client = | 1077 | sec_dai->dma_playback.client = |
@@ -1092,17 +1090,13 @@ static __devinit int samsung_i2s_probe(struct platform_device *pdev) | |||
1092 | if (i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) { | 1090 | if (i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) { |
1093 | dev_err(&pdev->dev, "Unable to configure gpio\n"); | 1091 | dev_err(&pdev->dev, "Unable to configure gpio\n"); |
1094 | ret = -EINVAL; | 1092 | ret = -EINVAL; |
1095 | goto err3; | 1093 | goto err; |
1096 | } | 1094 | } |
1097 | 1095 | ||
1098 | snd_soc_register_dai(&pri_dai->pdev->dev, &pri_dai->i2s_dai_drv); | 1096 | snd_soc_register_dai(&pri_dai->pdev->dev, &pri_dai->i2s_dai_drv); |
1099 | 1097 | ||
1100 | return 0; | 1098 | return 0; |
1101 | err3: | 1099 | err: |
1102 | kfree(sec_dai); | ||
1103 | err2: | ||
1104 | kfree(pri_dai); | ||
1105 | err1: | ||
1106 | release_mem_region(regs_base, resource_size(res)); | 1100 | release_mem_region(regs_base, resource_size(res)); |
1107 | 1101 | ||
1108 | return ret; | 1102 | return ret; |
@@ -1128,8 +1122,6 @@ static __devexit int samsung_i2s_remove(struct platform_device *pdev) | |||
1128 | i2s->pri_dai = NULL; | 1122 | i2s->pri_dai = NULL; |
1129 | i2s->sec_dai = NULL; | 1123 | i2s->sec_dai = NULL; |
1130 | 1124 | ||
1131 | kfree(i2s); | ||
1132 | |||
1133 | snd_soc_unregister_dai(&pdev->dev); | 1125 | snd_soc_unregister_dai(&pdev->dev); |
1134 | 1126 | ||
1135 | return 0; | 1127 | return 0; |