From patchwork Mon Nov 26 06:20:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13196 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 5F53523FCD for ; Mon, 26 Nov 2012 06:27:02 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 0FB86A1934C for ; Mon, 26 Nov 2012 06:27:01 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id t4so4991664iag.11 for ; Sun, 25 Nov 2012 22:27:01 -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=xU+kd00XNyqQjZrOfMf8zqoPsNEwEFy+9VIB/CVJBeM=; b=Q52ttxi2iQP1JUVdSk2Z0JcZJwb52oapdd9b24XpBvjVyhtRehO/z9E8BM0uXEAsbR TtroANgwrT9RHZSlkSG9EdT53HHwGmGNZJYn9IXrR8rMR2E8Wva+MYHGP5oaVmxH0NND SjvowMDVA6qSx1u7WMdG1wx/+caXvoE88Xk7Ng/q8AcwHv/FVkxElTwCGqpDV3ZIK0x3 +2Hn1q3syGXQk8BgGxp6tE/XJ+xSZGsOyiqlJw5aNlvo4FNJtDp+wP29yCkDiw7D4Xle +Rc//JcdmtcSK3wWDJejgkoq84swTpwMQymLIY8aX1OGnD6IqAxn3SNhZbDiUanPmPtJ XPhw== Received: by 10.50.161.169 with SMTP id xt9mr12453816igb.62.1353911221452; Sun, 25 Nov 2012 22:27:01 -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 n20csp209068igt; Sun, 25 Nov 2012 22:27:00 -0800 (PST) Received: by 10.68.238.8 with SMTP id vg8mr34983399pbc.26.1353911220450; Sun, 25 Nov 2012 22:27:00 -0800 (PST) Received: from mail-da0-f41.google.com (mail-da0-f41.google.com [209.85.210.41]) by mx.google.com with ESMTPS id az5si18201651pbd.234.2012.11.25.22.27.00 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 25 Nov 2012 22:27:00 -0800 (PST) Received-SPF: neutral (google.com: 209.85.210.41 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.210.41; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.41 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-f41.google.com with SMTP id e20so2926752dak.28 for ; Sun, 25 Nov 2012 22:27:00 -0800 (PST) Received: by 10.68.237.135 with SMTP id vc7mr34813009pbc.2.1353911220215; Sun, 25 Nov 2012 22:27:00 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id o1sm8215060paz.34.2012.11.25.22.26.56 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 25 Nov 2012 22:26:59 -0800 (PST) From: Sachin Kamat To: linux-media@vger.kernel.org Cc: shaik.ameer@samsung.com, sylvester.nawrocki@gmail.com, s.nawrocki@samsung.com, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 2/3] [media] exynos-gsc: Correct clock handling Date: Mon, 26 Nov 2012 11:50:20 +0530 Message-Id: <1353910821-21408-3-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1353910821-21408-1-git-send-email-sachin.kamat@linaro.org> References: <1353910821-21408-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQlYOHFVNDVG6Mbrm1dqia27byweRqeR8UA6y0ajlrLcWCd2O5xqSAu+FPez739U75CFxnzA From: Sylwester Nawrocki Make sure there is no unbalanced clk_unprepare call and add missing clock release in the driver's remove() callback. Signed-off-by: Sylwester Nawrocki Signed-off-by: Sachin Kamat --- drivers/media/platform/exynos-gsc/gsc-core.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index 45bcfa7..c8b82c0 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c @@ -1002,12 +1002,11 @@ static void *gsc_get_drv_data(struct platform_device *pdev) static void gsc_clk_put(struct gsc_dev *gsc) { - if (IS_ERR_OR_NULL(gsc->clock)) - return; - - clk_unprepare(gsc->clock); - clk_put(gsc->clock); - gsc->clock = NULL; + if (!IS_ERR(gsc->clock)) { + clk_unprepare(gsc->clock); + clk_put(gsc->clock); + gsc->clock = NULL; + } } static int gsc_clk_get(struct gsc_dev *gsc) @@ -1028,7 +1027,7 @@ static int gsc_clk_get(struct gsc_dev *gsc) dev_err(&gsc->pdev->dev, "clock prepare failed for clock: %s\n", GSC_CLOCK_GATE_NAME); clk_put(gsc->clock); - gsc->clock = NULL; + gsc->clock = ERR_PTR(-EINVAL); goto err_clk_prepare; } @@ -1106,6 +1105,7 @@ static int gsc_probe(struct platform_device *pdev) init_waitqueue_head(&gsc->irq_queue); spin_lock_init(&gsc->slock); mutex_init(&gsc->lock); + gsc->clock = ERR_PTR(-EINVAL); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); gsc->regs = devm_request_and_ioremap(dev, res); @@ -1169,6 +1169,7 @@ static int __devexit gsc_remove(struct platform_device *pdev) vb2_dma_contig_cleanup_ctx(gsc->alloc_ctx); pm_runtime_disable(&pdev->dev); + gsc_clk_put(gsc); dev_dbg(&pdev->dev, "%s driver unloaded\n", pdev->name); return 0;