linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Johan Hovold" <johan@kernel.org>,
	"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-serial@vger.kernel.org
Subject: Re: [PATCH v8 1/1] serial: core: Start managing serial controllers to enable runtime PM
Date: Wed, 22 Mar 2023 17:44:54 +0200	[thread overview]
Message-ID: <20230322154454.GN7501@atomide.com> (raw)
In-Reply-To: <ZBsUmkqKnP/jrNjv@smile.fi.intel.com>

* Andy Shevchenko <andriy.shevchenko@intel.com> [230322 14:45]:
> On Wed, Mar 22, 2023 at 01:12:51PM +0200, Tony Lindgren wrote:
> > +	device_initialize(&sbd->dev);
> > +	sbd->dev.parent = parent_dev;
> > +	sbd->dev.bus = &serial_base_bus_type;
> > +	sbd->dev.release = &serial_base_release;
> > +
> > +	if (str_has_prefix(name, "ctrl")) {
> > +		id = port->ctrl_id;
> > +	} else {
> > +		id = port->line;
> > +		sbd->port = port;
> > +	}
> > +
> > +	err = dev_set_name(&sbd->dev, "%s.%s.%d", name, dev_name(port->dev), id);
> > +	if (err)
> > +		goto err_free_dev;
> > +
> > +	err = device_add(&sbd->dev);
> > +	if (err)
> > +		goto err_put_device;
> > +
> > +	return &sbd->dev;
> > +
> > +err_put_device:
> > +	put_device(&sbd->dev);
> 
> > +	kfree_const(sbd->dev.kobj.name);
> 
> This is double free if not const, right?
> At least that's how I read kobject_cleanup() implementation.
> 
> Sorry I haven't paid attention to this earlier.

Thanks for spotting that, will drop it. Looks like we have the name
allocated by kobject_set_name_vargs(), and then kobject_cleanup()
frees it.

> ...
> 
> > +/*
> > + * Serial core port device driver
> > + */
> 
> Put it on one line for now?

Sure, will do.

Thanks,

Tony

      reply	other threads:[~2023-03-22 15:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 11:12 [PATCH v8 1/1] serial: core: Start managing serial controllers to enable runtime PM Tony Lindgren
2023-03-22 14:45 ` Andy Shevchenko
2023-03-22 15:44   ` Tony Lindgren [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=20230322154454.GN7501@atomide.com \
    --to=tony@atomide.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=vigneshr@ti.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;
as well as URLs for NNTP newsgroup(s).