From: Greg KH <gregkh@linuxfoundation.org>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Guenter Roeck <linux@roeck-us.net>,
Oliver Neukum <oneukum@suse.com>,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCHv14 2/3] usb: USB Type-C connector class
Date: Thu, 5 Jan 2017 17:40:48 +0100 [thread overview]
Message-ID: <20170105164048.GA30628@kroah.com> (raw)
In-Reply-To: <20170105155402.GG3353@lahna.fi.intel.com>
On Thu, Jan 05, 2017 at 05:54:02PM +0200, Mika Westerberg wrote:
> > +
> > + ret = device_register(&alt->dev);
> > + if (ret) {
> > + int i;
> > +
> > + dev_err(parent, "failed to register alternate mode (%d)\n",
> > + ret);
> > +
> > + put_device(&alt->dev);
> > +
> > + for (i = 0; i < alt->n_modes; i++)
> > + kfree(alt->modes[i].desc);
> > + kfree(alt);
>
> Just checking: ->release() is not called when device_register() fails
> and that's why you release memory here?
If so, that's wrong. Please see the very good documentation for
device_register in the kernel itself, which says:
* NOTE: _Never_ directly free @dev after calling this function, even
* if it returned an error! Always use put_device() to give up the
* reference initialized in this function instead.
Please read the rest of the documentation there as well, it should
answer all of these types of questions...
Sometimes I wonder why I even wrote that stuff if no one ever reads
it...
Heikki, did you get others at Intel to review this? I don't see their
signed-off-by: on the patches. Please use the internal Intel kernel
developer mailing list for this type of thing, I thought I said I was
going to require that before I would accept these patches after the last
round of review I did.
I'm not going to look at these until you do that, sorry. You have
access to good resources, please use them and don't abuse the community
reviewers for basic things like this.
thanks,
greg k-h
next prev parent reply other threads:[~2017-01-05 16:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-05 11:01 [PATCHv14 0/3] USB Type-C Connector class Heikki Krogerus
2017-01-05 11:01 ` [PATCHv14 1/3] lib/string: add sysfs_match_string helper Heikki Krogerus
2017-01-05 11:01 ` [PATCHv14 2/3] usb: USB Type-C connector class Heikki Krogerus
2017-01-05 15:54 ` Mika Westerberg
2017-01-05 16:40 ` Greg KH [this message]
2017-01-06 10:54 ` Heikki Krogerus
2017-01-06 15:47 ` Guenter Roeck
2017-01-10 10:08 ` Oliver Neukum
2017-01-11 7:57 ` Heikki Krogerus
2017-01-11 9:05 ` Oliver Neukum
2017-01-09 16:59 ` Guenter Roeck
2017-01-10 8:54 ` Heikki Krogerus
2017-01-10 13:50 ` Guenter Roeck
2017-01-10 14:46 ` Heikki Krogerus
2017-01-10 17:35 ` Guenter Roeck
2017-01-11 11:05 ` Heikki Krogerus
2017-01-05 11:01 ` [PATCHv14 3/3] usb: typec: add driver for Intel Whiskey Cove PMIC USB Type-C PHY Heikki Krogerus
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=20170105164048.GA30628@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mika.westerberg@linux.intel.com \
--cc=oneukum@suse.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