From patchwork Mon Dec 24 08:33:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13685 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 57ABD23EC8 for ; Mon, 24 Dec 2012 08:42:10 +0000 (UTC) Received: from mail-vb0-f46.google.com (mail-vb0-f46.google.com [209.85.212.46]) by fiordland.canonical.com (Postfix) with ESMTP id F3C92A18DC6 for ; Mon, 24 Dec 2012 08:42:09 +0000 (UTC) Received: by mail-vb0-f46.google.com with SMTP id b13so7088499vby.19 for ; Mon, 24 Dec 2012 00:42:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=qgdtsv2+HVlAHoWI+9W3YA1nY5h0BsUqczay8BGUaUQ=; b=L02vcc0AtUJR9nlUKcz2urMUKaLx5DOF4JIBkNF1m4EwsMmaXrghOuMj/4EA06wsy6 iNTl+Mvt1eKa8paJ42yMhqKhz0IOO9KFPG3RCXvJsAVeSBrCcOYbRj0lWL7VpI8hbbKf aboC8rcY53Ii3u+AtfNEptWt8l1OU0rRh67drrNZYOJ1LHYyWpu26bpnTOm5E7vDEJQs QMq7cS2Xw9phyjnrKPG8azCwS+276/mhIOWJtGOe21JZeuDA3gyJ5zbI++bIEKTrm6iT +1TP+TBmTfRxKIDjX672/tRvKBYcXbhdTKLF20UzRJRueFjpDLMlRJnl5v/PBuDfnREC 1a/A== X-Received: by 10.58.198.164 with SMTP id jd4mr32908423vec.34.1356338529452; Mon, 24 Dec 2012 00:42:09 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.49.133 with SMTP id u5csp184115ven; Mon, 24 Dec 2012 00:42:08 -0800 (PST) X-Received: by 10.66.73.165 with SMTP id m5mr61116604pav.78.1356338528615; Mon, 24 Dec 2012 00:42:08 -0800 (PST) Received: from mail-da0-f52.google.com (mail-da0-f52.google.com [209.85.210.52]) by mx.google.com with ESMTPS id j9si20193574pay.115.2012.12.24.00.42.08 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 24 Dec 2012 00:42:08 -0800 (PST) Received-SPF: neutral (google.com: 209.85.210.52 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.210.52; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.52 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by mail-da0-f52.google.com with SMTP id f10so3050867dak.11 for ; Mon, 24 Dec 2012 00:42:08 -0800 (PST) X-Received: by 10.66.82.230 with SMTP id l6mr61426307pay.12.1356338528248; Mon, 24 Dec 2012 00:42:08 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id pv8sm11959096pbc.26.2012.12.24.00.42.05 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 24 Dec 2012 00:42:07 -0800 (PST) From: Sachin Kamat To: dri-devel@lists.freedesktop.org Cc: inki.dae@samsung.com, sachin.kamat@linaro.org, patches@linaro.org, airlied@linux.ie, Eunchul Kim Subject: [PATCH 02/10] drm/exynos: Remove explicit freeing using devm_* APIs in exynos_drm_fimc.c Date: Mon, 24 Dec 2012 14:03:43 +0530 Message-Id: <1356338031-23674-3-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1356338031-23674-1-git-send-email-sachin.kamat@linaro.org> References: <1356338031-23674-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQlabTY78y2ppyj013iW8wJ+mdjXEyPQYE05Q+yWxOWDbPV0oCverjmQ2gIqxDInis8gjnxu devm_* APIs are device managed and get freed automatically when the device detaches. Thus explicit freeing is not needed. This saves some code. Cc: Eunchul Kim Signed-off-by: Sachin Kamat --- drivers/gpu/drm/exynos/exynos_drm_fimc.c | 30 +++++++++--------------------- 1 files changed, 9 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c index 61ea242..ab75150 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c @@ -1742,64 +1742,58 @@ static int __devinit fimc_probe(struct platform_device *pdev) ctx->sclk_fimc_clk = clk_get(dev, "sclk_fimc"); if (IS_ERR(ctx->sclk_fimc_clk)) { dev_err(dev, "failed to get src fimc clock.\n"); - ret = PTR_ERR(ctx->sclk_fimc_clk); - goto err_ctx; + return PTR_ERR(ctx->sclk_fimc_clk); } clk_enable(ctx->sclk_fimc_clk); ctx->fimc_clk = clk_get(dev, "fimc"); if (IS_ERR(ctx->fimc_clk)) { dev_err(dev, "failed to get fimc clock.\n"); - ret = PTR_ERR(ctx->fimc_clk); clk_disable(ctx->sclk_fimc_clk); clk_put(ctx->sclk_fimc_clk); - goto err_ctx; + return PTR_ERR(ctx->fimc_clk); } ctx->wb_clk = clk_get(dev, "pxl_async0"); if (IS_ERR(ctx->wb_clk)) { dev_err(dev, "failed to get writeback a clock.\n"); - ret = PTR_ERR(ctx->wb_clk); clk_disable(ctx->sclk_fimc_clk); clk_put(ctx->sclk_fimc_clk); clk_put(ctx->fimc_clk); - goto err_ctx; + return PTR_ERR(ctx->wb_clk); } ctx->wb_b_clk = clk_get(dev, "pxl_async1"); if (IS_ERR(ctx->wb_b_clk)) { dev_err(dev, "failed to get writeback b clock.\n"); - ret = PTR_ERR(ctx->wb_b_clk); clk_disable(ctx->sclk_fimc_clk); clk_put(ctx->sclk_fimc_clk); clk_put(ctx->fimc_clk); clk_put(ctx->wb_clk); - goto err_ctx; + return PTR_ERR(ctx->wb_b_clk); } parent_clk = clk_get(dev, ddata->parent_clk); if (IS_ERR(parent_clk)) { dev_err(dev, "failed to get parent clock.\n"); - ret = PTR_ERR(parent_clk); clk_disable(ctx->sclk_fimc_clk); clk_put(ctx->sclk_fimc_clk); clk_put(ctx->fimc_clk); clk_put(ctx->wb_clk); clk_put(ctx->wb_b_clk); - goto err_ctx; + return PTR_ERR(parent_clk); } if (clk_set_parent(ctx->sclk_fimc_clk, parent_clk)) { dev_err(dev, "failed to set parent.\n"); - ret = -EINVAL; clk_put(parent_clk); clk_disable(ctx->sclk_fimc_clk); clk_put(ctx->sclk_fimc_clk); clk_put(ctx->fimc_clk); clk_put(ctx->wb_clk); clk_put(ctx->wb_b_clk); - goto err_ctx; + return -EINVAL; } clk_put(parent_clk); @@ -1825,7 +1819,7 @@ static int __devinit fimc_probe(struct platform_device *pdev) if (!res) { dev_err(dev, "failed to request irq resource.\n"); ret = -ENOENT; - goto err_get_regs; + goto err_clk; } ctx->irq = res->start; @@ -1833,7 +1827,7 @@ static int __devinit fimc_probe(struct platform_device *pdev) IRQF_ONESHOT, "drm_fimc", ctx); if (ret < 0) { dev_err(dev, "failed to request irq.\n"); - goto err_get_regs; + goto err_clk; } /* context initailization */ @@ -1879,15 +1873,12 @@ err_ippdrv_register: pm_runtime_disable(dev); err_get_irq: free_irq(ctx->irq, ctx); -err_get_regs: - devm_iounmap(dev, ctx->regs); err_clk: clk_put(ctx->sclk_fimc_clk); clk_put(ctx->fimc_clk); clk_put(ctx->wb_clk); clk_put(ctx->wb_b_clk); -err_ctx: - devm_kfree(dev, ctx); + return ret; } @@ -1905,15 +1896,12 @@ static int __devexit fimc_remove(struct platform_device *pdev) pm_runtime_disable(dev); free_irq(ctx->irq, ctx); - devm_iounmap(dev, ctx->regs); clk_put(ctx->sclk_fimc_clk); clk_put(ctx->fimc_clk); clk_put(ctx->wb_clk); clk_put(ctx->wb_b_clk); - devm_kfree(dev, ctx); - return 0; }