Commit 11a954ee authored by Wei Yongjun's avatar Wei Yongjun Committed by Herbert Xu

crypto: ingenic - Drop kfree for memory allocated with devm_kzalloc

It's not necessary to free memory allocated with devm_kzalloc
and using kfree leads to a double free.

Fixes: 190873a0 ("crypto: ingenic - Add hardware RNG for Ingenic JZ4780 and X1000")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: default avatar周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 9a5a668d
...@@ -92,8 +92,7 @@ static int ingenic_rng_probe(struct platform_device *pdev) ...@@ -92,8 +92,7 @@ static int ingenic_rng_probe(struct platform_device *pdev)
priv->base = devm_platform_ioremap_resource(pdev, 0); priv->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->base)) { if (IS_ERR(priv->base)) {
pr_err("%s: Failed to map RNG registers\n", __func__); pr_err("%s: Failed to map RNG registers\n", __func__);
ret = PTR_ERR(priv->base); return PTR_ERR(priv->base);
goto err_free_rng;
} }
priv->version = (enum ingenic_rng_version)of_device_get_match_data(&pdev->dev); priv->version = (enum ingenic_rng_version)of_device_get_match_data(&pdev->dev);
...@@ -106,17 +105,13 @@ static int ingenic_rng_probe(struct platform_device *pdev) ...@@ -106,17 +105,13 @@ static int ingenic_rng_probe(struct platform_device *pdev)
ret = hwrng_register(&priv->rng); ret = hwrng_register(&priv->rng);
if (ret) { if (ret) {
dev_err(&pdev->dev, "Failed to register hwrng\n"); dev_err(&pdev->dev, "Failed to register hwrng\n");
goto err_free_rng; return ret;
} }
platform_set_drvdata(pdev, priv); platform_set_drvdata(pdev, priv);
dev_info(&pdev->dev, "Ingenic RNG driver registered\n"); dev_info(&pdev->dev, "Ingenic RNG driver registered\n");
return 0; return 0;
err_free_rng:
kfree(priv);
return ret;
} }
static int ingenic_rng_remove(struct platform_device *pdev) static int ingenic_rng_remove(struct platform_device *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment