[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230529162741.abcbe3fjvmma7qn5@skbuf>
Date: Mon, 29 May 2023 19:27:41 +0300
From: Vladimir Oltean <olteanv@...il.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>,
Heiner Kallweit <hkallweit1@...il.com>,
Jiawen Wu <jiawenwu@...stnetic.com>,
Maxime Chevallier <maxime.chevallier@...tlin.com>,
Simon Horman <simon.horman@...igine.com>,
Jose Abreu <Jose.Abreu@...opsys.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
netdev@...r.kernel.org
Subject: Re: [PATCH net-next 2/6] net: pcs: xpcs: add xpcs_create_mdiodev()
On Mon, May 29, 2023 at 05:25:45PM +0200, Andrew Lunn wrote:
> > void xpcs_destroy(struct dw_xpcs *xpcs)
> > {
> > + if (xpcs)
> > + mdio_device_put(xpcs->mdiodev);
> > kfree(xpcs);
> > }
>
> Nit:
>
> Is the if () needed? Can destroy be called if create was not
> successful?
No, xpcs_destroy() shouldn't be (and isn't) called if xpcs_create()
or xpcs_create_mdiodev() wasn't successful. If it was, it would be
an indication of sloppy coding style, which can easily be avoided
for minor things like this.
Powered by blists - more mailing lists