aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2016-11-16 13:24:15 -0500
committerVinod Koul <vinod.koul@intel.com>2016-11-17 05:39:23 -0500
commitd5afc1b68a6ddc27746d31f775025afe75ec8122 (patch)
treef20ea6d2137c340c5233564f4de61380591676ed
parent740b4be3f742100ea66f0f9ee9715b10ee304a90 (diff)
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: Dan Carpenter <dan.carpenter@oracle.com> Fixes: 740b4be3f742 ("dmaengine: cpp41: Fix handling of error path") Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r--drivers/dma/cppi41.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c
index 4b52126c13cf..d5ba43a87a68 100644
--- a/drivers/dma/cppi41.c
+++ b/drivers/dma/cppi41.c
@@ -317,11 +317,12 @@ static irqreturn_t cppi41_irq(int irq, void *data)
317 317
318 while (val) { 318 while (val) {
319 u32 desc, len; 319 u32 desc, len;
320 int error;
320 321
321 status = pm_runtime_get(cdd->ddev.dev); 322 error = pm_runtime_get(cdd->ddev.dev);
322 if (status < 0) 323 if (error < 0)
323 dev_err(cdd->ddev.dev, "%s pm runtime get: %i\n", 324 dev_err(cdd->ddev.dev, "%s pm runtime get: %i\n",
324 __func__, status); 325 __func__, error);
325 326
326 q_num = __fls(val); 327 q_num = __fls(val);
327 val &= ~(1 << q_num); 328 val &= ~(1 << q_num);
@@ -367,6 +368,8 @@ static int cppi41_dma_alloc_chan_resources(struct dma_chan *chan)
367 368
368 error = pm_runtime_get_sync(cdd->ddev.dev); 369 error = pm_runtime_get_sync(cdd->ddev.dev);
369 if (error < 0) { 370 if (error < 0) {
371 dev_err(cdd->ddev.dev, "%s pm runtime get: %i\n",
372 __func__, error);
370 pm_runtime_put_noidle(cdd->ddev.dev); 373 pm_runtime_put_noidle(cdd->ddev.dev);
371 374
372 return error; 375 return error;
@@ -1072,8 +1075,8 @@ err_chans:
1072 deinit_cppi41(dev, cdd); 1075 deinit_cppi41(dev, cdd);
1073err_init_cppi: 1076err_init_cppi:
1074 pm_runtime_dont_use_autosuspend(dev); 1077 pm_runtime_dont_use_autosuspend(dev);
1075 pm_runtime_put_sync(dev);
1076err_get_sync: 1078err_get_sync:
1079 pm_runtime_put_sync(dev);
1077 pm_runtime_disable(dev); 1080 pm_runtime_disable(dev);
1078 iounmap(cdd->usbss_mem); 1081 iounmap(cdd->usbss_mem);
1079 iounmap(cdd->ctrl_mem); 1082 iounmap(cdd->ctrl_mem);