From: Johan Hovold <johan@kernel.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>,
Rich Felker <dalias@libc.org>,
John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Magnus Damm <damm@igel.co.jp>
Subject: Re: [PATCH 1/2] sh: kfr2r09: fix i2c adapter leak on USB gdaget setup
Date: Thu, 25 Jun 2026 08:45:19 +0200 [thread overview]
Message-ID: <ajzOfzITQffmfOV6@hovoldconsulting.com> (raw)
In-Reply-To: <CAMuHMdXAoZ6+Ch-qUhwbV=47PDHfgkARnZpo4h8y0h_uZP73Qw@mail.gmail.com>
Hi Geert,
On Wed, Jun 24, 2026 at 10:29:41AM +0200, Geert Uytterhoeven wrote:
> On Fri, 8 May 2026 at 14:06, Johan Hovold <johan@kernel.org> wrote:
> > Make sure to drop the reference taken to the I2C adapter (and its
> > module) when enabling USB gadget mode which prevents the adapter from
> > ever being deregistered.
> >
> > Fixes: 5a1c4cb5bc22 ("sh: add r8a66597 usb0 gadget to the kfr2r09 board")
> > Cc: stable@vger.kernel.org # 2.6.32
> > Cc: Magnus Damm <damm@igel.co.jp>
> > Signed-off-by: Johan Hovold <johan@kernel.org>
> > @@ -387,9 +387,16 @@ static int kfr2r09_usb0_gadget_i2c_setup(void)
> > msg.flags = 0;
> > ret = i2c_transfer(a, &msg, 1);
> > if (ret != 1)
> > - return -ENODEV;
> > + goto err_put_adapter;
> > +
> > + i2c_put_adapter(a);
> >
> > return 0;
> > +
> > +err_put_adapter:
> > + i2c_put_adapter(a);
> > +
> > + return -ENODEV;
>
> I case i2c_transfer() returns a negative error code (the other
> possible value is zero, right?), you might want to propagate that to
> the caller. However, the single caller replaces it by -ENODEV anyway,
> so I guess your patch is fine.
Yes, indeed, but that's arguably a separate change. And in this case it
doesn't really matter currently as you point out.
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Thanks for reviewing.
Johan
next prev parent reply other threads:[~2026-06-25 6:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-08 12:05 [PATCH 0/2] sh: kfr2r09: fix i2c adapter leaks Johan Hovold
2026-05-08 12:06 ` [PATCH 1/2] sh: kfr2r09: fix i2c adapter leak on USB gdaget setup Johan Hovold
2026-06-24 8:29 ` Geert Uytterhoeven
2026-06-25 6:45 ` Johan Hovold [this message]
2026-05-08 12:06 ` [PATCH 2/2] sh: kfr2r09: fix i2c adapter leak on serial console setup Johan Hovold
2026-06-24 8:30 ` Geert Uytterhoeven
2026-06-12 16:00 ` [PATCH 0/2] sh: kfr2r09: fix i2c adapter leaks Johan Hovold
2026-06-13 5:11 ` John Paul Adrian Glaubitz
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=ajzOfzITQffmfOV6@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=dalias@libc.org \
--cc=damm@igel.co.jp \
--cc=geert@linux-m68k.org \
--cc=glaubitz@physik.fu-berlin.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=ysato@users.sourceforge.jp \
/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