diff options
author | Lee Jones <lee.jones@linaro.org> | 2013-05-23 11:25:11 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-06-13 06:11:42 -0400 |
commit | 099053a497638a928dac278bd95f192220c3cde1 (patch) | |
tree | ba864c1bd924753b22a498e8d75f645d99722e7a /drivers/mfd | |
parent | 22f9ee756bfd9ce9b066e2f90cf9f002aa7d1d44 (diff) |
mfd: davinci_voicecodec: Convert to managed resources for allocating memory
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/davinci_voicecodec.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/mfd/davinci_voicecodec.c b/drivers/mfd/davinci_voicecodec.c index c60ab0c3c4db..b6e297363946 100644 --- a/drivers/mfd/davinci_voicecodec.c +++ b/drivers/mfd/davinci_voicecodec.c | |||
@@ -50,7 +50,8 @@ static int __init davinci_vc_probe(struct platform_device *pdev) | |||
50 | struct mfd_cell *cell = NULL; | 50 | struct mfd_cell *cell = NULL; |
51 | int ret; | 51 | int ret; |
52 | 52 | ||
53 | davinci_vc = kzalloc(sizeof(struct davinci_vc), GFP_KERNEL); | 53 | davinci_vc = devm_kzalloc(&pdev->dev, |
54 | sizeof(struct davinci_vc), GFP_KERNEL); | ||
54 | if (!davinci_vc) { | 55 | if (!davinci_vc) { |
55 | dev_dbg(&pdev->dev, | 56 | dev_dbg(&pdev->dev, |
56 | "could not allocate memory for private data\n"); | 57 | "could not allocate memory for private data\n"); |
@@ -61,8 +62,7 @@ static int __init davinci_vc_probe(struct platform_device *pdev) | |||
61 | if (IS_ERR(davinci_vc->clk)) { | 62 | if (IS_ERR(davinci_vc->clk)) { |
62 | dev_dbg(&pdev->dev, | 63 | dev_dbg(&pdev->dev, |
63 | "could not get the clock for voice codec\n"); | 64 | "could not get the clock for voice codec\n"); |
64 | ret = -ENODEV; | 65 | return -ENODEV; |
65 | goto fail1; | ||
66 | } | 66 | } |
67 | clk_enable(davinci_vc->clk); | 67 | clk_enable(davinci_vc->clk); |
68 | 68 | ||
@@ -145,8 +145,6 @@ fail2: | |||
145 | clk_disable(davinci_vc->clk); | 145 | clk_disable(davinci_vc->clk); |
146 | clk_put(davinci_vc->clk); | 146 | clk_put(davinci_vc->clk); |
147 | davinci_vc->clk = NULL; | 147 | davinci_vc->clk = NULL; |
148 | fail1: | ||
149 | kfree(davinci_vc); | ||
150 | 148 | ||
151 | return ret; | 149 | return ret; |
152 | } | 150 | } |
@@ -164,8 +162,6 @@ static int davinci_vc_remove(struct platform_device *pdev) | |||
164 | clk_put(davinci_vc->clk); | 162 | clk_put(davinci_vc->clk); |
165 | davinci_vc->clk = NULL; | 163 | davinci_vc->clk = NULL; |
166 | 164 | ||
167 | kfree(davinci_vc); | ||
168 | |||
169 | return 0; | 165 | return 0; |
170 | } | 166 | } |
171 | 167 | ||