All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shubhrajyoti <shubhrajyoti@ti.com>
To: Kevin Hilman <khilman@ti.com>
Cc: linux-omap@vger.kernel.org, linux-i2c@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, ben-linux@fluff.org,
	tony@atomide.com, w.sang@pengutronix.de
Subject: Re: [PATCH] I2C: OMAP: fix runtime PM get/put balance on error
Date: Fri, 29 Jun 2012 18:25:30 +0530	[thread overview]
Message-ID: <4FEDA5C2.3000905@ti.com> (raw)
In-Reply-To: <874npunx6a.fsf@ti.com>

On Friday 29 June 2012 05:32 PM, Kevin Hilman wrote:
> Shubhrajyoti D <shubhrajyoti@ti.com> writes:
>
>>     ensure pm_runtime_put() is called, on pm_runtime_get_sync()
>>     failure.
>>
>>     Without this, after a failed call, the runtime PM usecount will have
>>     been incremented, but not decremented causing the usecount to never
>>     reach zero after a failure. Thanks to Kevin for educating about it. 
>>     While at it also fix a missing pm_runtime_disable in the probe error
>>     path.
> This is the same subject and changelog as the patch I sent, but is a
> different patch.  
>
> Please write a new subject and a changelog specific to your patch.
OK.
Actually I did that on purpose your patch fixed the xfer call only.
I thought that since get_sync increments the count always we could extend
the patch to all the callers.
>
> As this changes the error/failure path, please be specific about how
> the failure modes were tested, and on which platforms.
I found and fixed by review only.
Didnt really hit the failure case.
>
>> Cc: Kevin Hilman <khilman@ti.com>
>> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
>> ---
>>  drivers/i2c/busses/i2c-omap.c |    7 +++----
>>  1 files changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
>> index 2500f19..c8e5c76 100644
>> --- a/drivers/i2c/busses/i2c-omap.c
>> +++ b/drivers/i2c/busses/i2c-omap.c
>> @@ -1113,10 +1113,10 @@ err_free_irq:
>>  	free_irq(dev->irq, dev);
>>  err_unuse_clocks:
>>  	omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
>> +err_free_mem:
>>  	pm_runtime_put(dev->dev);
>>  	iounmap(dev->base);
> This doesn't look right.  At least one of the gotos for this label, the
> ioremap has failed.
Yes , missed that thanks will fix it.
>
>>  	pm_runtime_disable(&pdev->dev);
>> -err_free_mem:
>>  	platform_set_drvdata(pdev, NULL);
>>  	kfree(dev);
>>  err_release_region:
>> @@ -1136,10 +1136,9 @@ static int __devexit omap_i2c_remove(struct platform_device *pdev)
>>  	free_irq(dev->irq, dev);
>>  	i2c_del_adapter(&dev->adapter);
>>  	ret = pm_runtime_get_sync(&pdev->dev);
>> -	if (IS_ERR_VALUE(ret))
>> -		return ret;
>> +	if (!IS_ERR_VALUE(ret))
>> +		omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
> this change isn't described in changelog
Will do so.
>
>> -	omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
>>  	pm_runtime_put(&pdev->dev);
>>  	pm_runtime_disable(&pdev->dev);
>>  	iounmap(dev->base);
> Kevin


WARNING: multiple messages have this Message-ID (diff)
From: shubhrajyoti@ti.com (Shubhrajyoti)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] I2C: OMAP: fix runtime PM get/put balance on error
Date: Fri, 29 Jun 2012 18:25:30 +0530	[thread overview]
Message-ID: <4FEDA5C2.3000905@ti.com> (raw)
In-Reply-To: <874npunx6a.fsf@ti.com>

On Friday 29 June 2012 05:32 PM, Kevin Hilman wrote:
> Shubhrajyoti D <shubhrajyoti@ti.com> writes:
>
>>     ensure pm_runtime_put() is called, on pm_runtime_get_sync()
>>     failure.
>>
>>     Without this, after a failed call, the runtime PM usecount will have
>>     been incremented, but not decremented causing the usecount to never
>>     reach zero after a failure. Thanks to Kevin for educating about it. 
>>     While at it also fix a missing pm_runtime_disable in the probe error
>>     path.
> This is the same subject and changelog as the patch I sent, but is a
> different patch.  
>
> Please write a new subject and a changelog specific to your patch.
OK.
Actually I did that on purpose your patch fixed the xfer call only.
I thought that since get_sync increments the count always we could extend
the patch to all the callers.
>
> As this changes the error/failure path, please be specific about how
> the failure modes were tested, and on which platforms.
I found and fixed by review only.
Didnt really hit the failure case.
>
>> Cc: Kevin Hilman <khilman@ti.com>
>> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
>> ---
>>  drivers/i2c/busses/i2c-omap.c |    7 +++----
>>  1 files changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
>> index 2500f19..c8e5c76 100644
>> --- a/drivers/i2c/busses/i2c-omap.c
>> +++ b/drivers/i2c/busses/i2c-omap.c
>> @@ -1113,10 +1113,10 @@ err_free_irq:
>>  	free_irq(dev->irq, dev);
>>  err_unuse_clocks:
>>  	omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
>> +err_free_mem:
>>  	pm_runtime_put(dev->dev);
>>  	iounmap(dev->base);
> This doesn't look right.  At least one of the gotos for this label, the
> ioremap has failed.
Yes , missed that thanks will fix it.
>
>>  	pm_runtime_disable(&pdev->dev);
>> -err_free_mem:
>>  	platform_set_drvdata(pdev, NULL);
>>  	kfree(dev);
>>  err_release_region:
>> @@ -1136,10 +1136,9 @@ static int __devexit omap_i2c_remove(struct platform_device *pdev)
>>  	free_irq(dev->irq, dev);
>>  	i2c_del_adapter(&dev->adapter);
>>  	ret = pm_runtime_get_sync(&pdev->dev);
>> -	if (IS_ERR_VALUE(ret))
>> -		return ret;
>> +	if (!IS_ERR_VALUE(ret))
>> +		omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
> this change isn't described in changelog
Will do so.
>
>> -	omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
>>  	pm_runtime_put(&pdev->dev);
>>  	pm_runtime_disable(&pdev->dev);
>>  	iounmap(dev->base);
> Kevin

  reply	other threads:[~2012-06-29 12:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-29  9:07 [PATCH] I2C: OMAP: fix runtime PM get/put balance on error Shubhrajyoti D
2012-06-29  9:07 ` Shubhrajyoti D
     [not found] ` <1340960868-7371-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
2012-06-29 12:02   ` Kevin Hilman
2012-06-29 12:02     ` Kevin Hilman
2012-06-29 12:55     ` Shubhrajyoti [this message]
2012-06-29 12:55       ` Shubhrajyoti
     [not found]       ` <4FEDA5C2.3000905-l0cyMroinI0@public.gmane.org>
2012-06-29 14:00         ` Kevin Hilman
2012-06-29 14:00           ` Kevin Hilman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FEDA5C2.3000905@ti.com \
    --to=shubhrajyoti@ti.com \
    --cc=ben-linux@fluff.org \
    --cc=khilman@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    --cc=w.sang@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.