diff mbox

[v2,0/4,media] exynos-gsc: Some fixes

Message ID 50B231C8.9040807@gmail.com
State New
Headers show

Commit Message

Sylwester Nawrocki Nov. 25, 2012, 2:57 p.m. UTC
Thanks Shaik,

Sachin, I've applied the last patch fixing the checkpatch.pl warning.

As for the remaining three, can you please squash them, together
with following patch

 From cb7b42d2089206c8134fa195c0d1f4145fcb4f72 Mon Sep 17 00:00:00 2001
From: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
Date: Sun, 25 Nov 2012 14:16:02 +0100
Subject: [PATCH] exynos-gsc: Correct clock handling

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 <sylvester.nawrocki@gmail.com>
---
  drivers/media/platform/exynos-gsc/gsc-core.c |    9 +++++----
  1 files changed, 5 insertions(+), 4 deletions(-)

  static int gsc_clk_get(struct gsc_dev *gsc)
@@ -1025,6 +1023,7 @@ static int gsc_clk_get(struct gsc_dev *gsc)
  	if (ret < 0) {
  		dev_err(&gsc->pdev->dev, "clock prepare failed for clock: %s\n",
  			GSC_CLOCK_GATE_NAME);
+		gsc->clock = ERR_PTR(-EINVAL);
  		return ret;
  	}

@@ -1097,6 +1096,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);
@@ -1160,6 +1160,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;
diff mbox

Patch

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c 
b/drivers/media/platform/exynos-gsc/gsc-core.c
index 5a285b2..0c22ad5 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1002,10 +1002,8 @@  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);
+	if (!IS_ERR(gsc->clock))
+		clk_unprepare(gsc->clock);
  }