kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Cooper <alcooperx@gmail.com>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Felipe Balbi <balbi@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	USB list <linux-usb@vger.kernel.org>,
	BCM Kernel Feedback <bcm-kernel-feedback-list@broadcom.com>,
	": Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 2/2] usb: bdc: Fix a resource leak in the error handling path of 'bdc_probe()'
Date: Tue, 31 Aug 2021 09:42:37 -0400	[thread overview]
Message-ID: <CAOGqxeXrkv2-7CX34QMQgmtkOwQo2fmmDYbKxJ3hUNAB3gXkEQ@mail.gmail.com> (raw)
In-Reply-To: <c56617ff-5d74-9b07-4bcc-25f3dd2aca64@gmail.com>

On Fri, Aug 20, 2021 at 4:03 PM Florian Fainelli <f.fainelli@gmail.com> wrote:
>
>
>
> On 8/18/2021 9:32 PM, Christophe JAILLET wrote:
> > If an error occurs after a successful 'clk_prepare_enable()' call, it must
> > be undone by a corresponding 'clk_disable_unprepare()' call.
> > This call is already present in the remove function.
> >
> > Add this call in the error handling path and reorder the code so that the
> > 'clk_prepare_enable()' call happens later in the function.
> > The goal is to have as much managed resources functions as possible
> > before the 'clk_prepare_enable()' call in order to keep the error handling
> > path simple.
> >
> > While at it, remove the now unneeded 'clk' variable.
> >
> > Fixes: c87dca047849 ("usb: bdc: Add clock enable for new chips with a separate BDC clock")
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>
> Acked-by: Florian Fainelli <f.fainelli@gmail.com>
>
> > ---
> > Review with care.
> > I don't like shuffling code like that because of possible side effect.
> > Moving the code related to this clk looks fine to me, but who knows...
>
> There are no register accesses until bdc_phy_init() gets called, so this
> looks fine to me. Al knows this code better than I do though, so it
> would be better to wait for his Acked-by tag.

This is safe.
Acked-by: Al Cooper <alcooperx@gmail.com>

> --
> Florian

  reply	other threads:[~2021-08-31 13:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-18 19:32 [PATCH 1/2] usb: bdc: Fix an error handling path in 'bdc_probe()' when no suitable DMA config is available Christophe JAILLET
2021-08-18 19:32 ` [PATCH 2/2] usb: bdc: Fix a resource leak in the error handling path of 'bdc_probe()' Christophe JAILLET
2021-08-20 20:03   ` Florian Fainelli
2021-08-31 13:42     ` Alan Cooper [this message]
2021-08-20 20:01 ` [PATCH 1/2] usb: bdc: Fix an error handling path in 'bdc_probe()' when no suitable DMA config is available Florian Fainelli

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=CAOGqxeXrkv2-7CX34QMQgmtkOwQo2fmmDYbKxJ3hUNAB3gXkEQ@mail.gmail.com \
    --to=alcooperx@gmail.com \
    --cc=balbi@kernel.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --subject='Re: [PATCH 2/2] usb: bdc: Fix a resource leak in the error handling path of '\''bdc_probe()'\''' \
    /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

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).