From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
To: Fuad Tabba <fuad.tabba@linux.dev>
Cc: "Manivannan Sadhasivam" <mani@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Rob Herring" <robh@kernel.org>, "Ray Jui" <rjui@broadcom.com>,
"Scott Branden" <sbranden@broadcom.com>,
bcm-kernel-feedback-list@broadcom.com,
"Marek Vasut" <marek.vasut+renesas@mailbox.org>,
linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, "Will Deacon" <will@kernel.org>,
"Fuad Tabba" <tabba@google.com>
Subject: Re: [PATCH] PCI: iproc: Use __free(device_node) in iproc_pcie_msi_enable()
Date: Wed, 23 Sep 2026 09:34:33 -0700 [thread overview]
Message-ID: <20260923093433.00006cab@oss.qualcomm.com> (raw)
In-Reply-To: <20260922210839.3765444-1-fuad.tabba@linux.dev>
On Tue, 22 Sep 2026 22:08:39 +0100
Fuad Tabba <fuad.tabba@linux.dev> wrote:
> Declare msi_node with __free(device_node) and drop the out_put_node
> label and its goto: the scoped cleanup puts the MSI controller node on
> every return, as the label did.
>
> No functional change intended.
>
> Suggested-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> Link: https://lore.kernel.org/linux-pci/61488ddc-b346-4ba3-b32a-e972a3bd75a4@mailbox.org/
> Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
Hi Fuad,
See the guidance notes in cleanup.h. Linus has stated a couple
of times that he really never wants to see = NULL pattern miles
from where it is allocated. Best you can do here is shift
it down to immediately before of_msi_xlate(). It is fine to declare
variables with destructors like this inline (i.e. not at top of function).
Admittedly if the scope shown here had gone a few lines further this
would look less bad!
> ---
> drivers/pci/controller/pcie-iproc.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c
> index afb3aa38ac6bb..b4f4e6e1d4b41 100644
> --- a/drivers/pci/controller/pcie-iproc.c
> +++ b/drivers/pci/controller/pcie-iproc.c
> @@ -1338,7 +1338,7 @@ static int iproc_pcie_msi_steer(struct iproc_pcie *pcie,
>
> static int iproc_pcie_msi_enable(struct iproc_pcie *pcie)
> {
> - struct device_node *msi_node = NULL;
> + struct device_node *msi_node __free(device_node) = NULL;
> int ret;
>
> /*
> @@ -1357,18 +1357,14 @@ static int iproc_pcie_msi_enable(struct iproc_pcie *pcie)
> if (pcie->need_msi_steer) {
> ret = iproc_pcie_msi_steer(pcie, msi_node);
> if (ret)
> - goto out_put_node;
> + return ret;
> }
>
> /*
> * If another MSI controller is being used, the call below should fail
> * but that is okay
> */
> - ret = iproc_msi_init(pcie, msi_node);
> -
> -out_put_node:
> - of_node_put(msi_node);
> - return ret;
> + return iproc_msi_init(pcie, msi_node);
> }
>
> static void iproc_pcie_msi_disable(struct iproc_pcie *pcie)
>
> base-commit: fd73f4a6659897191fa0d40695fe370925dd3780
next prev parent reply other threads:[~2026-09-23 16:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 21:08 [PATCH] PCI: iproc: Use __free(device_node) in iproc_pcie_msi_enable() Fuad Tabba
2026-09-22 21:12 ` sashiko-bot
2026-09-22 21:49 ` Marek Vasut
2026-09-23 16:34 ` Jonathan Cameron [this message]
2026-09-23 18:08 ` Fuad Tabba
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=20260923093433.00006cab@oss.qualcomm.com \
--to=jonathan.cameron@oss.qualcomm.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bhelgaas@google.com \
--cc=fuad.tabba@linux.dev \
--cc=kwilczynski@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=marek.vasut+renesas@mailbox.org \
--cc=rjui@broadcom.com \
--cc=robh@kernel.org \
--cc=sbranden@broadcom.com \
--cc=tabba@google.com \
--cc=will@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.