Commit f51f593b authored by Nishanth Menon's avatar Nishanth Menon Committed by Herbert Xu

crypto: omap-des - handle error of pm_runtime_get_sync

pm_runtime_get_sync may not always succeed depending on SoC involved.
So handle the error appropriately ensuring usage_count is accurate in
case of failure.
Signed-off-by: default avatarNishanth Menon <nm@ti.com>
Reviewed-by: default avatarFelipe Balbi <balbi@ti.com>
Reported-by: default avatarJoachim Eastwood <manabian@gmail.com>
Tested-by: default avatarJoachim Eastwood <manabian@gmail.com>
Acked-by: default avatarJoel Fernandes <joelf@ti.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 8ece1171
...@@ -223,12 +223,19 @@ static void omap_des_write_n(struct omap_des_dev *dd, u32 offset, ...@@ -223,12 +223,19 @@ static void omap_des_write_n(struct omap_des_dev *dd, u32 offset,
static int omap_des_hw_init(struct omap_des_dev *dd) static int omap_des_hw_init(struct omap_des_dev *dd)
{ {
int err;
/* /*
* clocks are enabled when request starts and disabled when finished. * clocks are enabled when request starts and disabled when finished.
* It may be long delays between requests. * It may be long delays between requests.
* Device might go to off mode to save power. * Device might go to off mode to save power.
*/ */
pm_runtime_get_sync(dd->dev); err = pm_runtime_get_sync(dd->dev);
if (err < 0) {
pm_runtime_put_noidle(dd->dev);
dev_err(dd->dev, "%s: failed to get_sync(%d)\n", __func__, err);
return err;
}
if (!(dd->flags & FLAGS_INIT)) { if (!(dd->flags & FLAGS_INIT)) {
dd->flags |= FLAGS_INIT; dd->flags |= FLAGS_INIT;
...@@ -1082,7 +1089,12 @@ static int omap_des_probe(struct platform_device *pdev) ...@@ -1082,7 +1089,12 @@ static int omap_des_probe(struct platform_device *pdev)
dd->phys_base = res->start; dd->phys_base = res->start;
pm_runtime_enable(dev); pm_runtime_enable(dev);
pm_runtime_get_sync(dev); err = pm_runtime_get_sync(dev);
if (err < 0) {
pm_runtime_put_noidle(dev);
dev_err(dd->dev, "%s: failed to get_sync(%d)\n", __func__, err);
goto err_get;
}
omap_des_dma_stop(dd); omap_des_dma_stop(dd);
...@@ -1147,6 +1159,7 @@ static int omap_des_probe(struct platform_device *pdev) ...@@ -1147,6 +1159,7 @@ static int omap_des_probe(struct platform_device *pdev)
err_irq: err_irq:
tasklet_kill(&dd->done_task); tasklet_kill(&dd->done_task);
tasklet_kill(&dd->queue_task); tasklet_kill(&dd->queue_task);
err_get:
pm_runtime_disable(dev); pm_runtime_disable(dev);
err_res: err_res:
dd = NULL; dd = NULL;
...@@ -1190,7 +1203,14 @@ static int omap_des_suspend(struct device *dev) ...@@ -1190,7 +1203,14 @@ static int omap_des_suspend(struct device *dev)
static int omap_des_resume(struct device *dev) static int omap_des_resume(struct device *dev)
{ {
pm_runtime_get_sync(dev); int err;
err = pm_runtime_get_sync(dev);
if (err < 0) {
pm_runtime_put_noidle(dev);
dev_err(dev, "%s: failed to get_sync(%d)\n", __func__, err);
return err;
}
return 0; return 0;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment