Commit d5afc1b6 authored by Tony Lindgren's avatar Tony Lindgren Committed by Vinod Koul

dmaengine: cppi41: More PM runtime fixes

Fix use of u32 instead of int for checking for negative errors values
as pointed out by Dan Carpenter <dan.carpenter@oracle.com>.

And while testing the PM runtime error path by randomly returning
failed values in runtime resume, I noticed two more places that need
fixing:

- If pm_runtime_get_sync() fails in probe, we still need to do
  pm_runtime_put_sync() to keep the use count happy. We could call
  pm_runtime_put_noidle() on the error path, but we're just going
  to call pm_runtime_disable() after that so pm_runtime_put_sync()
  will do what we want

- We should print an error if pm_runtime_get_sync() fails in
  cppi41_dma_alloc_chan_resources() so we know where it happens
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Fixes: 740b4be3 ("dmaengine: cpp41: Fix handling of error path")
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent 740b4be3
...@@ -317,11 +317,12 @@ static irqreturn_t cppi41_irq(int irq, void *data) ...@@ -317,11 +317,12 @@ static irqreturn_t cppi41_irq(int irq, void *data)
while (val) { while (val) {
u32 desc, len; u32 desc, len;
int error;
status = pm_runtime_get(cdd->ddev.dev); error = pm_runtime_get(cdd->ddev.dev);
if (status < 0) if (error < 0)
dev_err(cdd->ddev.dev, "%s pm runtime get: %i\n", dev_err(cdd->ddev.dev, "%s pm runtime get: %i\n",
__func__, status); __func__, error);
q_num = __fls(val); q_num = __fls(val);
val &= ~(1 << q_num); val &= ~(1 << q_num);
...@@ -367,6 +368,8 @@ static int cppi41_dma_alloc_chan_resources(struct dma_chan *chan) ...@@ -367,6 +368,8 @@ static int cppi41_dma_alloc_chan_resources(struct dma_chan *chan)
error = pm_runtime_get_sync(cdd->ddev.dev); error = pm_runtime_get_sync(cdd->ddev.dev);
if (error < 0) { if (error < 0) {
dev_err(cdd->ddev.dev, "%s pm runtime get: %i\n",
__func__, error);
pm_runtime_put_noidle(cdd->ddev.dev); pm_runtime_put_noidle(cdd->ddev.dev);
return error; return error;
...@@ -1072,8 +1075,8 @@ static int cppi41_dma_probe(struct platform_device *pdev) ...@@ -1072,8 +1075,8 @@ static int cppi41_dma_probe(struct platform_device *pdev)
deinit_cppi41(dev, cdd); deinit_cppi41(dev, cdd);
err_init_cppi: err_init_cppi:
pm_runtime_dont_use_autosuspend(dev); pm_runtime_dont_use_autosuspend(dev);
pm_runtime_put_sync(dev);
err_get_sync: err_get_sync:
pm_runtime_put_sync(dev);
pm_runtime_disable(dev); pm_runtime_disable(dev);
iounmap(cdd->usbss_mem); iounmap(cdd->usbss_mem);
iounmap(cdd->ctrl_mem); iounmap(cdd->ctrl_mem);
......
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