From: Dmitry Guzman <Dmitry.Guzman@mobileye.com>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: Linus Walleij <linusw@kernel.org>,
Andi Shyti <andi.shyti@kernel.org>,
srinidhi kasagar <srinidhi.kasagar@stericsson.com>,
Ben Dooks <ben-linux@fluff.org>,
Andrea Gallo <andrea.gallo@stericsson.com>,
linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/8] i2c: nomadik: handle pm_runtime errors
Date: Mon, 9 Nov 2026 10:06:06 +0200 [thread overview]
Message-ID: <20261109100606.493ca48095bcc3527be18573@mobileye.com> (raw)
In-Reply-To: <avFzEaxgam-UuZH0@ninjato>
Hi Wolfram,
On Mon, 9 Nov 2026 08:15:29 +0100
Wolfram Sang <wsa+renesas@sang-engineering.com> wrote:
> > Testbots revealed a smatch warning:
> >
> > drivers/i2c/busses/i2c-nomadik.c:737 nmk_i2c_xfer() warn: pm_runtime_get_sync() also returns 1 on success
> >
> > I will fix it here.
>
> Like this:
>
> diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
> index 104da275ff91..8cf1d443a25c 100644
> --- a/drivers/i2c/busses/i2c-nomadik.c
> +++ b/drivers/i2c/busses/i2c-nomadik.c
> @@ -734,13 +734,13 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap,
> struct nmk_i2c_dev *priv = i2c_get_adapdata(i2c_adap);
>
> status = pm_runtime_get_sync(&priv->adev->dev);
> - if (status)
> + if (status < 0)
> return status;
There is another problem with this patch:
include/linux/pm_runtime.h:
> * Note that the runtime PM usage counter of @dev remains incremented in all
> * cases, even if it returns an error code. Consider using
> * pm_runtime_resume_and_get() instead, especially if the return value is
> * checked by the caller, as this is likely to result in cleaner code.
I think we just need to replace pm_runtime_get_sync(&priv->adev->dev) with
pm_runtime_resume_and_get(&priv->adev->dev).
This solves both the positive return code issue and the usage counter leak.
Do you agree?
Best regards,
--
Dmitry Guzman <Dmitry.Guzman@mobileye.com>
next prev parent reply other threads:[~2026-11-09 8:20 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 8:29 [PATCH 0/8] i2c: nomadik: fix several issues in fault handling, optimize layout Dmitry Guzman
2026-11-03 8:29 ` [PATCH 1/8] i2c: nomadik: optimize struct layout, change unsigned char into u8 Dmitry Guzman
2026-11-03 8:29 ` [PATCH 2/8] i2c: nomadik: do not try to retransmit I2C message series on errors Dmitry Guzman
2026-11-03 8:29 ` [PATCH 3/8] i2c: nomadik: return proper fault codes Dmitry Guzman
2026-11-03 8:29 ` [PATCH 4/8] i2c: nomadik: change print level for fault messages to debug Dmitry Guzman
2026-11-03 8:29 ` [PATCH 5/8] i2c: nomadik: add quirks max_len=2047 and no_zero_len_read Dmitry Guzman
2026-11-05 8:40 ` Linus Walleij
2026-11-03 8:29 ` [PATCH 6/8] i2c: nomadik: handle pm_runtime errors Dmitry Guzman
2026-11-05 8:42 ` Linus Walleij
2026-11-05 8:51 ` Wolfram Sang
2026-11-08 10:27 ` Wolfram Sang
2026-11-09 7:03 ` Wolfram Sang
2026-11-09 7:15 ` Wolfram Sang
2026-11-09 8:06 ` Dmitry Guzman [this message]
2026-11-03 8:29 ` [PATCH 7/8] i2c: nomadik: fix race condition with interrupt handler Dmitry Guzman
2026-11-05 8:42 ` Linus Walleij
2026-11-03 8:29 ` [PATCH 8/8] i2c: nomadik: reduce FIFO flush timeout to avoid long interrupt handling Dmitry Guzman
2026-11-05 8:44 ` Linus Walleij
2026-11-08 10:19 ` Wolfram Sang
2026-11-08 10:16 ` [PATCH 0/8] i2c: nomadik: fix several issues in fault handling, optimize layout Wolfram Sang
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=20261109100606.493ca48095bcc3527be18573@mobileye.com \
--to=dmitry.guzman@mobileye.com \
--cc=andi.shyti@kernel.org \
--cc=andrea.gallo@stericsson.com \
--cc=ben-linux@fluff.org \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=srinidhi.kasagar@stericsson.com \
--cc=wsa+renesas@sang-engineering.com \
/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
all inboxes | Powered by JetHome®