提交 d52dc81e 编写于 作者: L Lokesh Vutla 提交者: Herbert Xu

hwrng: omap - Convert to devm_kzalloc()

Use devm_kzalloc() to make cleanup paths simpler.
Signed-off-by: NLokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 4390f77b
...@@ -109,7 +109,8 @@ static int omap_rng_probe(struct platform_device *pdev) ...@@ -109,7 +109,8 @@ static int omap_rng_probe(struct platform_device *pdev)
struct omap_rng_private_data *priv; struct omap_rng_private_data *priv;
int ret; int ret;
priv = kzalloc(sizeof(struct omap_rng_private_data), GFP_KERNEL); priv = devm_kzalloc(&pdev->dev, sizeof(struct omap_rng_private_data),
GFP_KERNEL);
if (!priv) { if (!priv) {
dev_err(&pdev->dev, "could not allocate memory\n"); dev_err(&pdev->dev, "could not allocate memory\n");
return -ENOMEM; return -ENOMEM;
...@@ -144,8 +145,6 @@ static int omap_rng_probe(struct platform_device *pdev) ...@@ -144,8 +145,6 @@ static int omap_rng_probe(struct platform_device *pdev)
priv->base = NULL; priv->base = NULL;
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
err_ioremap: err_ioremap:
kfree(priv);
return ret; return ret;
} }
...@@ -160,10 +159,6 @@ static int __exit omap_rng_remove(struct platform_device *pdev) ...@@ -160,10 +159,6 @@ static int __exit omap_rng_remove(struct platform_device *pdev)
pm_runtime_put_sync(&pdev->dev); pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
release_mem_region(priv->mem_res->start, resource_size(priv->mem_res));
kfree(priv);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册