Netdev List
 help / color / mirror / Atom feed
From: Horatiu Vultur <horatiu.vultur@microchip.com>
To: Liang He <windhl@126.com>
Cc: <andrew@lunn.ch>, <hkallweit1@gmail.com>, <linux@armlinux.org.uk>,
	<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <netdev@vger.kernel.org>,
	<david.daney@cavium.com>
Subject: Re: [PATCH] net: mdio: thunder: Add missing fwnode_handle_put()
Date: Thu, 23 Mar 2023 08:36:55 +0100	[thread overview]
Message-ID: <20230323073655.mppg4ty6qcqcpdmp@soft-dev3-1> (raw)
In-Reply-To: <21d42d91.1283.1870c2c39cf.Coremail.windhl@126.com>

The 03/23/2023 09:53, Liang He wrote:
> 
> At 2023-03-22 16:55:38, "Horatiu Vultur" <horatiu.vultur@microchip.com> wrote:
> >The 03/22/2023 14:20, Liang He wrote:
> >>
> >> In device_for_each_child_node(), we should add fwnode_handle_put()
> >> when break out of the iteration device_for_each_child_node()
> >> as it will automatically increase and decrease the refcounter.
> >
> >Don't forget to mention the tree which you are targeting.
> >It shoud be something like:
> >"[PATCH net] net: mdio: thunder: Add missing fwnode_handle_put()" and
> >you can achieve this using option --subject-prefix when you create your
> >patch:
> >git format-patch ... --subject-prefix "PATCH net"
> >
> 
> Thanks for your reply and advise, I will add it in my future patches.
> 
> >
> >>
> >> Fixes: 379d7ac7ca31 ("phy: mdio-thunder: Add driver for Cavium Thunder SoC MDIO buses.")
> >> Signed-off-by: Liang He <windhl@126.com>
> >> ---
> >>  drivers/net/mdio/mdio-thunder.c | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/drivers/net/mdio/mdio-thunder.c b/drivers/net/mdio/mdio-thunder.c
> >> index 822d2cdd2f35..394b864aaa37 100644
> >> --- a/drivers/net/mdio/mdio-thunder.c
> >> +++ b/drivers/net/mdio/mdio-thunder.c
> >> @@ -104,6 +104,7 @@ static int thunder_mdiobus_pci_probe(struct pci_dev *pdev,
> >>                 if (i >= ARRAY_SIZE(nexus->buses))
> >>                         break;
> >>         }
> >> +       fwnode_handle_put(fwn);
> >
> >Can you declare only 1 mdio bus in the DT under this pci device?
> >Because in that case, I don't think this is correct, because then
> >'device_for_each_child_node' will exit before all 4 mdio buses are probed.
> >And according to the comments for 'fwnode_handle_put' you need to use
> >with break or return.
> >
> 
> In fact, the fwnode_handle_put(fwn) consider the NULL-check of fwn, and
> there are only break, not return, so I think it can work in this case.
> However, if you prefer to add fwnode_handle_put before break, I can
> send a new patch.

You are right, fwnode_handle_put checks for NULL.
It is up too you how you prefer.

> 
> Thanks,
> Liang
> 
> >>         return 0;
> >>
> >>  err_release_regions:
> >> --
> >> 2.25.1
> >>
> >
> >--
> >/Horatiu

-- 
/Horatiu

  reply	other threads:[~2023-03-23  7:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22  6:20 [PATCH] net: mdio: thunder: Add missing fwnode_handle_put() Liang He
2023-03-22  8:55 ` Horatiu Vultur
2023-03-23  1:53   ` Liang He
2023-03-23  7:36     ` Horatiu Vultur [this message]
2023-03-23  8:50 ` patchwork-bot+netdevbpf

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=20230323073655.mppg4ty6qcqcpdmp@soft-dev3-1 \
    --to=horatiu.vultur@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=david.daney@cavium.com \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=windhl@126.com \
    /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