diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2012-12-15 23:50:48 +0100 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2013-01-25 09:24:21 +0900 |
commit | 1724acfd598bdf688218bdd26a5f02dd55b6ec62 (patch) | |
tree | de92bd2a54456da3df5bc9a4f082f025447fe4fa /drivers/sh/pfc/core.c | |
parent | c6193eacda6d50c405b0d484f5f2577ff9068a13 (diff) | |
download | linux-1724acfd598bdf688218bdd26a5f02dd55b6ec62.tar.bz2 |
sh-pfc: Use devm_kzalloc()
Replace probe-time kmalloc()/kzalloc() calls with devm_kzalloc() and get
rid of the corresponding kfree() calls.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'drivers/sh/pfc/core.c')
-rw-r--r-- | drivers/sh/pfc/core.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/sh/pfc/core.c b/drivers/sh/pfc/core.c index 6d162e694e68..54919026ac12 100644 --- a/drivers/sh/pfc/core.c +++ b/drivers/sh/pfc/core.c @@ -33,9 +33,6 @@ static void pfc_iounmap(struct sh_pfc *pfc) for (k = 0; k < pfc->pdata->num_resources; k++) if (pfc->window[k].virt) iounmap(pfc->window[k].virt); - - kfree(pfc->window); - pfc->window = NULL; } static int pfc_ioremap(struct sh_pfc *pfc) @@ -46,10 +43,10 @@ static int pfc_ioremap(struct sh_pfc *pfc) if (!pfc->pdata->num_resources) return 0; - pfc->window = kzalloc(pfc->pdata->num_resources * sizeof(*pfc->window), - GFP_NOWAIT); + pfc->window = devm_kzalloc(pfc->dev, pfc->pdata->num_resources * + sizeof(*pfc->window), GFP_NOWAIT); if (!pfc->window) - goto err1; + return -ENOMEM; for (k = 0; k < pfc->pdata->num_resources; k++) { res = pfc->pdata->resource + k; @@ -58,16 +55,13 @@ static int pfc_ioremap(struct sh_pfc *pfc) pfc->window[k].size = resource_size(res); pfc->window[k].virt = ioremap_nocache(res->start, resource_size(res)); - if (!pfc->window[k].virt) - goto err2; + if (!pfc->window[k].virt) { + pfc_iounmap(pfc); + return -ENOMEM; + } } return 0; - -err2: - pfc_iounmap(pfc); -err1: - return -1; } static void __iomem *pfc_phys_to_virt(struct sh_pfc *pfc, |