From patchwork Fri Nov 23 11:50:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13144 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 2C3BB23DFE for ; Fri, 23 Nov 2012 11:57:07 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id CEB32A186E6 for ; Fri, 23 Nov 2012 11:57:06 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so1705179ieb.11 for ; Fri, 23 Nov 2012 03:57:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=3yWBgUlBKOW8ndzHEnf5nLwc1DRRUd5vBBkVc6G2mRU=; b=Iv8ciRBKCC50RyNuglvC9h4NqQxJRe7uXy/rKblDsksJS12sPhQvtVyCpQT/itvtZ9 WH8+EHL97LQeMRjp2KWzMubFIaamzUx45RwPnjbonzHkmNx9hHd4r4REzONiqknGyqzj 3lyIClVeZvxSvjwmKSQggeX2GfPt83Q/nthmFZKF5L/bfcOG/IfsxaabsA7k6xXd91LB 6fexpGQnIBjiU/8eptF3VTui+aJnp2t/rpKR9HIfH9wrysOsR7A5nDzewKJptJ/m9uqM UEcc7j25XUhOU9tNt0fyZ/Au7hL9KhOWvupni5QoC5xTvgLkkCVwuBiI69QfN4vZ1NeA Fcgg== Received: by 10.50.213.69 with SMTP id nq5mr5823740igc.70.1353671826595; Fri, 23 Nov 2012 03:57:06 -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.50.67.148 with SMTP id n20csp341256igt; Fri, 23 Nov 2012 03:57:06 -0800 (PST) Received: by 10.68.251.197 with SMTP id zm5mr13620454pbc.30.1353671826104; Fri, 23 Nov 2012 03:57:06 -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 bd1si4091080pab.102.2012.11.23.03.57.05 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 23 Nov 2012 03:57:06 -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 f10so4581697dak.39 for ; Fri, 23 Nov 2012 03:57:05 -0800 (PST) Received: by 10.68.196.170 with SMTP id in10mr13948131pbc.0.1353671825834; Fri, 23 Nov 2012 03:57:05 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id zv10sm3718784pbc.76.2012.11.23.03.57.03 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 23 Nov 2012 03:57:05 -0800 (PST) From: Sachin Kamat To: linux-media@vger.kernel.org Cc: s.nawrocki@samsung.com, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 2/6] [media] s5p-fimc: Use devm_clk_get in fimc-core.c Date: Fri, 23 Nov 2012 17:20:39 +0530 Message-Id: <1353671443-2978-3-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1353671443-2978-1-git-send-email-sachin.kamat@linaro.org> References: <1353671443-2978-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQm7pdkJVR7byQl0WA77Jn1aiMUzpZNAcMnTlY6aoLLIBlgKO2S4TRAfQdhXVLl7LEgK3MB4 devm_clk_get is device managed and makes error handling and cleanup a bit simpler. Signed-off-by: Sachin Kamat --- drivers/media/platform/s5p-fimc/fimc-core.c | 10 ++-------- 1 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/s5p-fimc/fimc-core.c b/drivers/media/platform/s5p-fimc/fimc-core.c index 8d0d2b9..0c45127 100644 --- a/drivers/media/platform/s5p-fimc/fimc-core.c +++ b/drivers/media/platform/s5p-fimc/fimc-core.c @@ -814,8 +814,6 @@ static void fimc_clk_put(struct fimc_dev *fimc) if (IS_ERR_OR_NULL(fimc->clock[i])) continue; clk_unprepare(fimc->clock[i]); - clk_put(fimc->clock[i]); - fimc->clock[i] = NULL; } } @@ -824,19 +822,15 @@ static int fimc_clk_get(struct fimc_dev *fimc) int i, ret; for (i = 0; i < MAX_FIMC_CLOCKS; i++) { - fimc->clock[i] = clk_get(&fimc->pdev->dev, fimc_clocks[i]); + fimc->clock[i] = devm_clk_get(&fimc->pdev->dev, fimc_clocks[i]); if (IS_ERR(fimc->clock[i])) goto err; ret = clk_prepare(fimc->clock[i]); - if (ret < 0) { - clk_put(fimc->clock[i]); - fimc->clock[i] = NULL; + if (ret < 0) goto err; - } } return 0; err: - fimc_clk_put(fimc); dev_err(&fimc->pdev->dev, "failed to get clock: %s\n", fimc_clocks[i]); return -ENXIO;