[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c56617ff-5d74-9b07-4bcc-25f3dd2aca64@gmail.com>
Date: Fri, 20 Aug 2021 22:03:11 +0200
From: Florian Fainelli <f.fainelli@...il.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>,
alcooperx@...il.com, balbi@...nel.org, gregkh@...uxfoundation.org
Cc: linux-usb@...r.kernel.org, bcm-kernel-feedback-list@...adcom.com,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 2/2] usb: bdc: Fix a resource leak in the error handling
path of 'bdc_probe()'
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@...adoo.fr>
Acked-by: Florian Fainelli <f.fainelli@...il.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.
--
Florian
Powered by blists - more mailing lists