mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-16 01:54:00 +00:00
crypto: omap-sham - 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>
This commit is contained in:
parent
0de9c3876b
commit
7a7e4b73b5
@ -1870,7 +1870,7 @@ static int omap_sham_probe(struct platform_device *pdev)
|
|||||||
int err, i, j;
|
int err, i, j;
|
||||||
u32 rev;
|
u32 rev;
|
||||||
|
|
||||||
dd = kzalloc(sizeof(struct omap_sham_dev), GFP_KERNEL);
|
dd = devm_kzalloc(dev, sizeof(struct omap_sham_dev), GFP_KERNEL);
|
||||||
if (dd == NULL) {
|
if (dd == NULL) {
|
||||||
dev_err(dev, "unable to alloc data struct.\n");
|
dev_err(dev, "unable to alloc data struct.\n");
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
@ -1887,12 +1887,12 @@ static int omap_sham_probe(struct platform_device *pdev)
|
|||||||
err = (dev->of_node) ? omap_sham_get_res_of(dd, dev, &res) :
|
err = (dev->of_node) ? omap_sham_get_res_of(dd, dev, &res) :
|
||||||
omap_sham_get_res_pdev(dd, pdev, &res);
|
omap_sham_get_res_pdev(dd, pdev, &res);
|
||||||
if (err)
|
if (err)
|
||||||
goto res_err;
|
goto data_err;
|
||||||
|
|
||||||
dd->io_base = devm_ioremap_resource(dev, &res);
|
dd->io_base = devm_ioremap_resource(dev, &res);
|
||||||
if (IS_ERR(dd->io_base)) {
|
if (IS_ERR(dd->io_base)) {
|
||||||
err = PTR_ERR(dd->io_base);
|
err = PTR_ERR(dd->io_base);
|
||||||
goto res_err;
|
goto data_err;
|
||||||
}
|
}
|
||||||
dd->phys_base = res.start;
|
dd->phys_base = res.start;
|
||||||
|
|
||||||
@ -1901,7 +1901,7 @@ static int omap_sham_probe(struct platform_device *pdev)
|
|||||||
if (err) {
|
if (err) {
|
||||||
dev_err(dev, "unable to request irq %d, err = %d\n",
|
dev_err(dev, "unable to request irq %d, err = %d\n",
|
||||||
dd->irq, err);
|
dd->irq, err);
|
||||||
goto res_err;
|
goto data_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
dma_cap_zero(mask);
|
dma_cap_zero(mask);
|
||||||
@ -1913,7 +1913,7 @@ static int omap_sham_probe(struct platform_device *pdev)
|
|||||||
dev_err(dev, "unable to obtain RX DMA engine channel %u\n",
|
dev_err(dev, "unable to obtain RX DMA engine channel %u\n",
|
||||||
dd->dma);
|
dd->dma);
|
||||||
err = -ENXIO;
|
err = -ENXIO;
|
||||||
goto res_err;
|
goto data_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
dd->flags |= dd->pdata->flags;
|
dd->flags |= dd->pdata->flags;
|
||||||
@ -1951,9 +1951,6 @@ err_algs:
|
|||||||
&dd->pdata->algs_info[i].algs_list[j]);
|
&dd->pdata->algs_info[i].algs_list[j]);
|
||||||
pm_runtime_disable(dev);
|
pm_runtime_disable(dev);
|
||||||
dma_release_channel(dd->dma_lch);
|
dma_release_channel(dd->dma_lch);
|
||||||
res_err:
|
|
||||||
kfree(dd);
|
|
||||||
dd = NULL;
|
|
||||||
data_err:
|
data_err:
|
||||||
dev_err(dev, "initialization failed.\n");
|
dev_err(dev, "initialization failed.\n");
|
||||||
|
|
||||||
@ -1978,8 +1975,6 @@ static int omap_sham_remove(struct platform_device *pdev)
|
|||||||
tasklet_kill(&dd->done_task);
|
tasklet_kill(&dd->done_task);
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
dma_release_channel(dd->dma_lch);
|
dma_release_channel(dd->dma_lch);
|
||||||
kfree(dd);
|
|
||||||
dd = NULL;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user