diff options
author | Lokesh Vutla <lokeshvutla@ti.com> | 2013-07-26 02:59:17 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2013-07-31 20:54:01 -0400 |
commit | 7a7e4b73b5e3244063c224c307b1b4b8a0110d6d (patch) | |
tree | 6cf5b570c06369e895d0682d24a6d821a62e830d /drivers/crypto/omap-sham.c | |
parent | 0de9c3876b36147e931f475ae435bab04398cd60 (diff) |
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>
Diffstat (limited to 'drivers/crypto/omap-sham.c')
-rw-r--r-- | drivers/crypto/omap-sham.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index b82b140e843a..ae1ca8b2dfb2 100644 --- a/drivers/crypto/omap-sham.c +++ b/drivers/crypto/omap-sham.c | |||
@@ -1870,7 +1870,7 @@ static int omap_sham_probe(struct platform_device *pdev) | |||
1870 | int err, i, j; | 1870 | int err, i, j; |
1871 | u32 rev; | 1871 | u32 rev; |
1872 | 1872 | ||
1873 | dd = kzalloc(sizeof(struct omap_sham_dev), GFP_KERNEL); | 1873 | dd = devm_kzalloc(dev, sizeof(struct omap_sham_dev), GFP_KERNEL); |
1874 | if (dd == NULL) { | 1874 | if (dd == NULL) { |
1875 | dev_err(dev, "unable to alloc data struct.\n"); | 1875 | dev_err(dev, "unable to alloc data struct.\n"); |
1876 | err = -ENOMEM; | 1876 | err = -ENOMEM; |
@@ -1887,12 +1887,12 @@ static int omap_sham_probe(struct platform_device *pdev) | |||
1887 | err = (dev->of_node) ? omap_sham_get_res_of(dd, dev, &res) : | 1887 | err = (dev->of_node) ? omap_sham_get_res_of(dd, dev, &res) : |
1888 | omap_sham_get_res_pdev(dd, pdev, &res); | 1888 | omap_sham_get_res_pdev(dd, pdev, &res); |
1889 | if (err) | 1889 | if (err) |
1890 | goto res_err; | 1890 | goto data_err; |
1891 | 1891 | ||
1892 | dd->io_base = devm_ioremap_resource(dev, &res); | 1892 | dd->io_base = devm_ioremap_resource(dev, &res); |
1893 | if (IS_ERR(dd->io_base)) { | 1893 | if (IS_ERR(dd->io_base)) { |
1894 | err = PTR_ERR(dd->io_base); | 1894 | err = PTR_ERR(dd->io_base); |
1895 | goto res_err; | 1895 | goto data_err; |
1896 | } | 1896 | } |
1897 | dd->phys_base = res.start; | 1897 | dd->phys_base = res.start; |
1898 | 1898 | ||
@@ -1901,7 +1901,7 @@ static int omap_sham_probe(struct platform_device *pdev) | |||
1901 | if (err) { | 1901 | if (err) { |
1902 | dev_err(dev, "unable to request irq %d, err = %d\n", | 1902 | dev_err(dev, "unable to request irq %d, err = %d\n", |
1903 | dd->irq, err); | 1903 | dd->irq, err); |
1904 | goto res_err; | 1904 | goto data_err; |
1905 | } | 1905 | } |
1906 | 1906 | ||
1907 | dma_cap_zero(mask); | 1907 | dma_cap_zero(mask); |
@@ -1913,7 +1913,7 @@ static int omap_sham_probe(struct platform_device *pdev) | |||
1913 | dev_err(dev, "unable to obtain RX DMA engine channel %u\n", | 1913 | dev_err(dev, "unable to obtain RX DMA engine channel %u\n", |
1914 | dd->dma); | 1914 | dd->dma); |
1915 | err = -ENXIO; | 1915 | err = -ENXIO; |
1916 | goto res_err; | 1916 | goto data_err; |
1917 | } | 1917 | } |
1918 | 1918 | ||
1919 | dd->flags |= dd->pdata->flags; | 1919 | dd->flags |= dd->pdata->flags; |
@@ -1951,9 +1951,6 @@ err_algs: | |||
1951 | &dd->pdata->algs_info[i].algs_list[j]); | 1951 | &dd->pdata->algs_info[i].algs_list[j]); |
1952 | pm_runtime_disable(dev); | 1952 | pm_runtime_disable(dev); |
1953 | dma_release_channel(dd->dma_lch); | 1953 | dma_release_channel(dd->dma_lch); |
1954 | res_err: | ||
1955 | kfree(dd); | ||
1956 | dd = NULL; | ||
1957 | data_err: | 1954 | data_err: |
1958 | dev_err(dev, "initialization failed.\n"); | 1955 | dev_err(dev, "initialization failed.\n"); |
1959 | 1956 | ||
@@ -1978,8 +1975,6 @@ static int omap_sham_remove(struct platform_device *pdev) | |||
1978 | tasklet_kill(&dd->done_task); | 1975 | tasklet_kill(&dd->done_task); |
1979 | pm_runtime_disable(&pdev->dev); | 1976 | pm_runtime_disable(&pdev->dev); |
1980 | dma_release_channel(dd->dma_lch); | 1977 | dma_release_channel(dd->dma_lch); |
1981 | kfree(dd); | ||
1982 | dd = NULL; | ||
1983 | 1978 | ||
1984 | return 0; | 1979 | return 0; |
1985 | } | 1980 | } |