Re: [PATCH] USB: musb: dsps: move debugfs_remove_recursive()

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

 



On Wed, Apr 02, 2014 at 11:46:51AM +0200, Daniel Mack wrote:
> When the platform initialization fails due to missing resources, it will
> return -EPROBE_DEFER after dsps_musb_init() has been called.
> 
> dsps_musb_init() calls dsps_musb_dbg_init() to allocate the debugfs
> nodes. At a later point in time, the probe will be retried, and
> dsps_musb_dbg_init() will be called again. debugfs_create_dir() will
> fail this time, as the node already exists, and so the entire device
> probe will fail with -ENOMEM.
> 
> Fix this by moving debugfs_remove_recursive() from dsps_remove() to the
> plaform's exit function, so it will be cleanly torn down when the probe
> fails. It also feels more natural this way, as .exit is the counterpart
> to .init.
> 
> Signed-off-by: Daniel Mack <zonque@xxxxxxxxx>
> ---
> Only the current 'next' branch which will be merged into 3.15 is affected.
> 
>  drivers/usb/musb/musb_dsps.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
> index 3372ded..e2fd263 100644
> --- a/drivers/usb/musb/musb_dsps.c
> +++ b/drivers/usb/musb/musb_dsps.c
> @@ -470,8 +470,9 @@ static int dsps_musb_exit(struct musb *musb)
>  	struct dsps_glue *glue = dev_get_drvdata(dev->parent);
>  
>  	del_timer_sync(&glue->timer);
> -
>  	usb_phy_shutdown(musb->xceiv);
> +	debugfs_remove_recursive(glue->dbgfs_root);
> +
>  	return 0;
>  }
>  
> @@ -708,8 +709,6 @@ static int dsps_remove(struct platform_device *pdev)
>  	pm_runtime_put(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);
>  
> -	debugfs_remove_recursive(glue->dbgfs_root);

I don't think this is the right fix. debugfs_remove_recursive is
supposed to remove the directory as well. Why isn't dsps_musb_exit()
called ? I can see it being called from musb_remove() -> musb_shutdown()
-> musb_platform_exit(). Looks like the problem is elsewhere.

-- 
balbi

Attachment: signature.asc
Description: Digital signature


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

  Powered by Linux