[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230322154454.GN7501@atomide.com>
Date: Wed, 22 Mar 2023 17:44:54 +0200
From: Tony Lindgren <tony@...mide.com>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
Johan Hovold <johan@...nel.org>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Vignesh Raghavendra <vigneshr@...com>,
linux-omap@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-serial@...r.kernel.org
Subject: Re: [PATCH v8 1/1] serial: core: Start managing serial controllers
to enable runtime PM
* Andy Shevchenko <andriy.shevchenko@...el.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
Powered by blists - more mailing lists