[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140723184041.GA24850@arch.cereza>
Date: Wed, 23 Jul 2014 15:40:41 -0300
From: Ezequiel Garcia <ezequiel.garcia@...e-electrons.com>
To: Florian Fainelli <f.fainelli@...il.com>
Cc: netdev <netdev@...r.kernel.org>,
David Miller <davem@...emloft.net>,
Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
Gregory Clement <gregory.clement@...e-electrons.com>
Subject: Re: [PATCH 2/2] net: phy: Ensure the MDIO bus module is held
On 23 Jul 11:22 AM, Florian Fainelli wrote:
> 2014-07-22 17:16 GMT-07:00 Ezequiel Garcia <ezequiel.garcia@...e-electrons.com>:
> > @@ -614,10 +623,14 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
> > */
> > err = phy_init_hw(phydev);
> > if (err)
> > - phy_detach(phydev);
> > - else
> > - phy_resume(phydev);
> > + goto err_module_put;
> >
> > + phy_resume(phydev);
> > + return err;
> > +
> > +err_module_put:
> > + module_put(bus_module);
> > + phy_detach(phydev);
>
> Since we are calling phy_detach() which is also attempting to do a
> module_put(), does not that result in one too many calls to
> module_put() on error path?
>
As far as I can see all that module_get() and module_put() do
is increment and decrement refcounters. Therefore, I think you can
have as many module_{get,put}() calls as you want on a path.
--
Ezequiel GarcĂa, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists