aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorLokesh Vutla <lokeshvutla@ti.com>2013-08-05 10:47:19 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2013-08-09 02:39:46 -0400
commitd52dc81e14c648fb1015d51c658347127d624173 (patch)
treeba4daa6dcd8601942af794c6fc4f6752494c0e29 /drivers/char
parent4390f77b37b89d32236676a48997d83489feff4e (diff)
hwrng: omap - Convert to devm_kzalloc()
Use devm_kzalloc() to make cleanup paths simpler. Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/hw_random/omap-rng.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
index 3e9a7ecbd5e5..9c19396b940f 100644
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -109,7 +109,8 @@ static int omap_rng_probe(struct platform_device *pdev)
109 struct omap_rng_private_data *priv; 109 struct omap_rng_private_data *priv;
110 int ret; 110 int ret;
111 111
112 priv = kzalloc(sizeof(struct omap_rng_private_data), GFP_KERNEL); 112 priv = devm_kzalloc(&pdev->dev, sizeof(struct omap_rng_private_data),
113 GFP_KERNEL);
113 if (!priv) { 114 if (!priv) {
114 dev_err(&pdev->dev, "could not allocate memory\n"); 115 dev_err(&pdev->dev, "could not allocate memory\n");
115 return -ENOMEM; 116 return -ENOMEM;
@@ -144,8 +145,6 @@ err_register:
144 priv->base = NULL; 145 priv->base = NULL;
145 pm_runtime_disable(&pdev->dev); 146 pm_runtime_disable(&pdev->dev);
146err_ioremap: 147err_ioremap:
147 kfree(priv);
148
149 return ret; 148 return ret;
150} 149}
151 150
@@ -160,10 +159,6 @@ static int __exit omap_rng_remove(struct platform_device *pdev)
160 pm_runtime_put_sync(&pdev->dev); 159 pm_runtime_put_sync(&pdev->dev);
161 pm_runtime_disable(&pdev->dev); 160 pm_runtime_disable(&pdev->dev);
162 161
163 release_mem_region(priv->mem_res->start, resource_size(priv->mem_res));
164
165 kfree(priv);
166
167 return 0; 162 return 0;
168} 163}
169 164