linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Mc Guire <der.herr@hofr.at>
To: Tobias Jordan <Tobias.Jordan@elektrobit.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Michal Simek <michal.simek@xilinx.com>,
	Wolfram Sang <wsa@the-dreams.de>
Subject: Re: [SIL2review] [PATCH] i2c: cadence: Fix PM device usage count
Date: Mon, 26 Feb 2018 09:20:07 +0000	[thread overview]
Message-ID: <20180226092007.GC6152@osadl.at> (raw)
In-Reply-To: <20180224224238.nlr3mrifwngjzkrz@agrajag.zerfleddert.de>

On Sat, Feb 24, 2018 at 11:42:38PM +0100, Tobias Jordan wrote:
> pm_runtime_get_sync() increases the device's usage count even when
> reporting an error, so add a call to pm_runtime_put_noidle() in the
> error branch.
> 
> Fixes: 7fa32329ca03 ("i2c: cadence: Move to sensible power management")
> Signed-off-by: Tobias Jordan <Tobias.Jordan@elektrobit.com>
> ---
> This is one of a number of patches for problems found using coccinelle
> scripting in the SIL2LinuxMP project. The patch has been compile-tested;
> it's based on linux-next-20180223.
> 
> For a discussion of the corresponding issue, see
> https://marc.info/?l=linux-pm&m=151904483924999&w=2

just wondering if that should not be above the --- as:

Link: https://marc.info/?l=linux-pm&m=151904483924999&w=2

notably as the discussion about why not to fix it in __pm_runtime_resume
would seem reasonable to carry into the mainline logs.

thx!
hforat

> 
>  drivers/i2c/busses/i2c-cadence.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
> index b13605718291..898faa7fbac5 100644
> --- a/drivers/i2c/busses/i2c-cadence.c
> +++ b/drivers/i2c/busses/i2c-cadence.c
> @@ -574,8 +574,10 @@ static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
>  	bool hold_quirk;
>  
>  	ret = pm_runtime_get_sync(id->dev);
> -	if (ret < 0)
> +	if (ret < 0) {
> +		pm_runtime_put_noidle(id->dev);
>  		return ret;
> +	}
>  	/* Check if the bus is free */
>  	if (cdns_i2c_readreg(CDNS_I2C_SR_OFFSET) & CDNS_I2C_SR_BA) {
>  		ret = -EAGAIN;
> -- 
> 2.11.0
> 
> _______________________________________________
> SIL2review mailing list
> SIL2review@lists.osadl.org
> https://lists.osadl.org/mailman/listinfo/sil2review

      reply	other threads:[~2018-02-26  9:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-24 22:42 [PATCH] i2c: cadence: Fix PM device usage count Tobias Jordan
2018-02-26  9:20 ` Nicholas Mc Guire [this message]

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=20180226092007.GC6152@osadl.at \
    --to=der.herr@hofr.at \
    --cc=Tobias.Jordan@elektrobit.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=wsa@the-dreams.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).