Re: [PATCH] dma: cpp41: Fix handling of error path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Saturday 12 November 2016 12:58 AM, Tony Lindgren wrote:
> If we return early on pm_runtime_get() error, we need to also call
> pm_runtime_put_noidle() as pointed out in a musb related thread
> by Johan Hovold <johan@xxxxxxxxxx>. This is to keep the PM runtime
> use counts happy.
> 
> Fixes: fdea2d09b997 ("dmaengine: cppi41: Add basic PM runtime support")
> Cc: Johan Hovold <johan@xxxxxxxxxx>
> Signed-off-by: Tony Lindgren <tony@xxxxxxxxxxx>
> ---
>  drivers/dma/cppi41.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c
> --- a/drivers/dma/cppi41.c
> +++ b/drivers/dma/cppi41.c
> @@ -366,8 +366,11 @@ static int cppi41_dma_alloc_chan_resources(struct dma_chan *chan)
>  	int error;
>  
>  	error = pm_runtime_get_sync(cdd->ddev.dev);
> -	if (error < 0)
> +	if (error < 0) {
> +		pm_runtime_put_noidle(cdd->ddev.dev);
> +

If pm_runtime_get_sync() fails due to callback error, then
rpm_callback() sets dev.power.runtime_error to an error value which gets
cleared by an explicit call to pm_runtime_set_suspended().

This will tell the framework that the status of device is suspended.
Else, the failure will be sticky and on subsequent attempts,
rpm_resume() will keep returning early instead of trying to resume the
device again.

This is as far as I can gather from code. So, I believe the recovery
path should be:

	if (error < 0) {
		pm_runtime_set_suspended(cdd->ddev.dev);
		pm_runtime_put_noidle(cdd->ddev.dev);

		...

Thanks,
Sekhar
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux