linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: jun.li@nxp.com, heikki.krogerus@linux.intel.com
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-imx@nxp.com
Subject: Re: [PATCH 2/2] usb: typec: tcpm: remove tcpm dir if no children
Date: Wed, 17 Jul 2019 06:33:37 -0700	[thread overview]
Message-ID: <2a9f2e6e-e497-e141-801f-c18224017524@roeck-us.net> (raw)
In-Reply-To: <20190717080646.30421-2-jun.li@nxp.com>

On 7/17/19 1:06 AM, jun.li@nxp.com wrote:
> From: Li Jun <jun.li@nxp.com>
> 
> If config tcpm as module, module unload will not remove tcpm dir,
> then the next module load will have problem: the rootdir is NULL
> but tcpm dir is still there, so tcpm_debugfs_init() will create
> tcpm dir again with failure, fix it by remove the tcpm dir if no
> children.
> 
> Cc: stable@vger.kernel.org # v4.15+
> Fixes: 4b4e02c83167 ("typec: tcpm: Move out of staging")
> Signed-off-by: Li Jun <jun.li@nxp.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/usb/typec/tcpm/tcpm.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 1249d8e..86e4552 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -596,6 +596,10 @@ static void tcpm_debugfs_exit(struct tcpm_port *port)
>   	mutex_unlock(&port->logbuffer_lock);
>   
>   	debugfs_remove(port->dentry);
> +	if (list_empty(&rootdir->d_subdirs)) {
> +		debugfs_remove(rootdir);
> +		rootdir = NULL;
> +	}
>   }
>   
>   #else
> 


  reply	other threads:[~2019-07-17 13:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-17  8:06 [PATCH 1/2] usb: typec: tcpm: free log buf memory when remove debug file jun.li
2019-07-17  8:06 ` [PATCH 2/2] usb: typec: tcpm: remove tcpm dir if no children jun.li
2019-07-17 13:33   ` Guenter Roeck [this message]
2019-07-17 13:32 ` [PATCH 1/2] usb: typec: tcpm: free log buf memory when remove debug file Guenter Roeck

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=2a9f2e6e-e497-e141-801f-c18224017524@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jun.li@nxp.com \
    --cc=linux-imx@nxp.com \
    --cc=linux-usb@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).