Input: s3c2410_ts - handle return value of clk_prepare_enable
authorArvind Yadav <arvind.yadav.cs@gmail.com>
Tue, 30 May 2017 16:44:28 +0000 (09:44 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 3 Jun 2017 00:57:26 +0000 (17:57 -0700)
clk_prepare_enable() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/touchscreen/s3c2410_ts.c

index 41d58e88cc8a0de6c1e42eec64801e8838ff0447..3b3db8c868e01f81878563a1ae8a74cda41cf372 100644 (file)
@@ -264,7 +264,11 @@ static int s3c2410ts_probe(struct platform_device *pdev)
                return -ENOENT;
        }
 
-       clk_prepare_enable(ts.clock);
+       ret = clk_prepare_enable(ts.clock);
+       if (ret) {
+               dev_err(dev, "Failed! to enabled clocks\n");
+               goto err_clk_get;
+       }
        dev_dbg(dev, "got and enabled clocks\n");
 
        ts.irq_tc = ret = platform_get_irq(pdev, 0);
@@ -353,7 +357,9 @@ static int s3c2410ts_probe(struct platform_device *pdev)
  err_iomap:
        iounmap(ts.io);
  err_clk:
+       clk_disable_unprepare(ts.clock);
        del_timer_sync(&touch_timer);
+ err_clk_get:
        clk_put(ts.clock);
        return ret;
 }