diff options
author | Arvind Yadav <arvind.yadav.cs@gmail.com> | 2017-08-08 15:24:56 +0530 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2017-09-05 08:46:01 +0100 |
commit | b62d8dbe419893b7aee5fac282e1da8c811cfcfb (patch) | |
tree | de9a18bf7cb1579e047085e18ff1182a3cd6c1e5 /drivers/mfd/t7l66xb.c | |
parent | e10feb36c98576fd7d1f24edaf2669dbfe7df21d (diff) | |
download | linux-b62d8dbe419893b7aee5fac282e1da8c811cfcfb.tar.gz linux-b62d8dbe419893b7aee5fac282e1da8c811cfcfb.tar.bz2 linux-b62d8dbe419893b7aee5fac282e1da8c811cfcfb.zip |
mfd: t7l66xb: Handle return value of clk_prepare_enable
clk_prepare_enable() can fail here and we must check its return value.
we must disable clock, if t7l66xb_probe is not successful.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/t7l66xb.c')
-rw-r--r-- | drivers/mfd/t7l66xb.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/mfd/t7l66xb.c b/drivers/mfd/t7l66xb.c index 22c811396edc..43d8683266de 100644 --- a/drivers/mfd/t7l66xb.c +++ b/drivers/mfd/t7l66xb.c @@ -86,8 +86,11 @@ static int t7l66xb_mmc_enable(struct platform_device *mmc) struct t7l66xb *t7l66xb = platform_get_drvdata(dev); unsigned long flags; u8 dev_ctl; + int ret; - clk_prepare_enable(t7l66xb->clk32k); + ret = clk_prepare_enable(t7l66xb->clk32k); + if (ret) + return ret; raw_spin_lock_irqsave(&t7l66xb->lock, flags); @@ -286,8 +289,12 @@ static int t7l66xb_resume(struct platform_device *dev) { struct t7l66xb *t7l66xb = platform_get_drvdata(dev); struct t7l66xb_platform_data *pdata = dev_get_platdata(&dev->dev); + int ret; + + ret = clk_prepare_enable(t7l66xb->clk48m); + if (ret) + return ret; - clk_prepare_enable(t7l66xb->clk48m); if (pdata && pdata->resume) pdata->resume(dev); @@ -361,7 +368,9 @@ static int t7l66xb_probe(struct platform_device *dev) goto err_ioremap; } - clk_prepare_enable(t7l66xb->clk48m); + ret = clk_prepare_enable(t7l66xb->clk48m); + if (ret) + goto err_clk_enable; if (pdata->enable) pdata->enable(dev); @@ -386,6 +395,8 @@ static int t7l66xb_probe(struct platform_device *dev) return 0; t7l66xb_detach_irq(dev); + clk_disable_unprepare(t7l66xb->clk48m); +err_clk_enable: iounmap(t7l66xb->scr); err_ioremap: release_resource(&t7l66xb->rscr); |