Re: [PATCH 2/4] usb: chipidea: ci_hdrc_imx: remove an unsolicited module_put() call from ci_hdrc_imx_remove()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 01, 2013 at 10:38:18AM +0200, Lothar Waßmann wrote:
> Hi,
> 
> Peter Chen writes:
> > On Wed, Jul 31, 2013 at 04:21:14PM +0200, Lothar Waßmann wrote:
> > > This prevents the USB PHY refcount to be decremented below zero upon
> > > unloading the ci-hdrc-imx module.
> > > 
> > > Signed-off-by: Lothar Waßmann <LW@xxxxxxxxxxxxxxxxxxx>
> > > ---
> > >  drivers/usb/chipidea/ci_hdrc_imx.c |    4 +---
> > >  1 files changed, 1 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
> > > index 14362c0..802eab1 100644
> > > --- a/drivers/usb/chipidea/ci_hdrc_imx.c
> > > +++ b/drivers/usb/chipidea/ci_hdrc_imx.c
> > > @@ -218,10 +218,8 @@ static int ci_hdrc_imx_remove(struct platform_device *pdev)
> > >  	if (data->reg_vbus)
> > >  		regulator_disable(data->reg_vbus);
> > >  
> > > -	if (data->phy) {
> > > +	if (data->phy)
> > >  		usb_phy_shutdown(data->phy);
> > > -		module_put(data->phy->dev->driver->owner);
> > > -	}
> > >  
> > >  	clk_disable_unprepare(data->clk);
> > 
> > Have you met warning? devm_usb_get_phy_by_phandle at probe calls
> > try_module_get.
> > 
> Since it is a 'devm_*' function I would vouch that it also takes care
> of the module_put() automagically.
> 
> Just try loading and unloading the ci-hdrc-imx module and look at the
> resulting refcount of the mxs_usb_phy module.
> 
> refcounting is OK without the module_put() here.
> 

Oh, yes, it calls module_put at usb_put_phy when devm_xxx_release is
called.

Acked-by: Peter Chen <peter.chen@xxxxxxxxxxxxx>

-- 

Best Regards,
Peter Chen

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux