[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YxsEfcTAw0v/JFes@lpieralisi>
Date: Fri, 9 Sep 2022 11:16:45 +0200
From: Lorenzo Pieralisi <lpieralisi@...nel.org>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: Alyssa Rosenzweig <alyssa@...enzweig.io>,
Marc Zyngier <maz@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof WilczyĆski <kw@...ux.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Hector Martin <marcan@...can.st>,
Sven Peter <sven@...npeter.dev>, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] PCI: apple: do not leak reset GPIO on unbind/unload/error
Nit: please capitalize beginning of the sentence in the subject - that's
what we do for PCI controllers commits.
"PCI: apple: Do not leak reset GPIO on unbind/unload/error"
On Mon, Sep 05, 2022 at 07:15:23PM -0700, Dmitry Torokhov wrote:
> The driver allocates reset GPIO in apple_pcie_setup_port() but neither
> releases the resource, nor uses devm API to have it released
> automatically.
>
> Let's fix this by switching to devm API. While at it let's use generic
> devm_fwnode_gpiod_get() instead of OF-specific gpiod_get_from_of_node()
> - this will allow us top stop exporting the latter down the road.
>
> Fixes: 1e33888fbe44 ("PCI: apple: Add initial hardware bring-up")
Should I take it via the PCI tree ? Usually we send fixes through -rcX
only if the fix applies to code merged last merge window, which is not
the case here, so I would queue if for v6.1.
Lorenzo
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
> ---
>
> This patch has been pulled out of the series
> https://lore.kernel.org/all/20220903-gpiod_get_from_of_node-remove-v1-0-b29adfb27a6c@gmail.com/
> with updated justification (leak fix vs pure API deprecation).
>
> drivers/pci/controller/pcie-apple.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c
> index a2c3c207a04b..66f37e403a09 100644
> --- a/drivers/pci/controller/pcie-apple.c
> +++ b/drivers/pci/controller/pcie-apple.c
> @@ -516,8 +516,8 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,
> u32 stat, idx;
> int ret, i;
>
> - reset = gpiod_get_from_of_node(np, "reset-gpios", 0,
> - GPIOD_OUT_LOW, "PERST#");
> + reset = devm_fwnode_gpiod_get(pcie->dev, of_fwnode_handle(np), "reset",
> + GPIOD_OUT_LOW, "PERST#");
> if (IS_ERR(reset))
> return PTR_ERR(reset);
>
> --
> 2.37.2.789.g6183377224-goog
>
>
> --
> Dmitry
Powered by blists - more mailing lists