Linux USB
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Greg KH <gregkh@linuxfoundation.org>, Yuho Choi <dbgh9129@gmail.com>
Cc: heikki.krogerus@linux.intel.com, sebastian.reichel@collabora.com,
	tglx@kernel.org, alchark@flipper.net,
	u.kleine-koenig@baylibre.com, ustc.gu@gmail.com,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] usb: typec: fusb302: Free log buffers on exit
Date: Wed, 26 Aug 2026 10:46:16 +0200	[thread overview]
Message-ID: <20260826084616.V9emV9vv@linutronix.de> (raw)
In-Reply-To: <2026080802-finicky-exclaim-0def@gregkh>

On 2026-08-08 09:10:28 [+0200], Greg KH wrote:
> > --- a/drivers/usb/typec/tcpm/fusb302.c
> > +++ b/drivers/usb/typec/tcpm/fusb302.c
> > @@ -223,7 +223,16 @@ static void fusb302_debugfs_init(struct fusb302_chip *chip)
> >  
> >  static void fusb302_debugfs_exit(struct fusb302_chip *chip)
> >  {
> > +	int i;
> > +
> >  	debugfs_remove(chip->dentry);
> > +
> > +	mutex_lock(&chip->logbuffer_lock);
> > +	for (i = 0; i < LOG_BUFFER_ENTRIES; i++) {
> > +		kfree(chip->logbuffer[i]);
> > +		chip->logbuffer[i] = NULL;
> > +	}
> > +	mutex_unlock(&chip->logbuffer_lock);
> 
> As you are tearing things down here, and there is no actual user, why is
> the lock needed?  And if so, can you just use a guard() instead?

That is correct. The whole thing is about vanish so locking is not
needed.
Looking at the actual user of that buffer, I'm curious if it wouldn't be
better to use dev_err()/ dev_info() for some of the output and other
which are just pure informative/ debug kind of information, hide behind
a trace event which can be enabled if needed.

> thanks,
> 
> greg k-h

Sebastian

      reply	other threads:[~2026-08-26  8:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 20:34 [PATCH v1] usb: typec: fusb302: Free log buffers on exit Yuho Choi
2026-08-08  7:10 ` Greg KH
2026-08-26  8:46   ` Sebastian Andrzej Siewior [this message]

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=20260826084616.V9emV9vv@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=alchark@flipper.net \
    --cc=dbgh9129@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sebastian.reichel@collabora.com \
    --cc=tglx@kernel.org \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=ustc.gu@gmail.com \
    /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