From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: dbrownell@users.sourceforge.net, greg@kroah.com,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
linuxppc-dev@ozlabs.org, leoli@freescale.com,
timur@freescale.com
Subject: Re: [PATCH] USB: Driver for Freescale QUICC Engine USB Host Controller
Date: Wed, 24 Dec 2008 22:11:23 +0300 [thread overview]
Message-ID: <20081224191123.GA16966@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20081223132840.55e7b666.akpm@linux-foundation.org>
On Tue, Dec 23, 2008 at 01:28:40PM -0800, Andrew Morton wrote:
> On Wed, 24 Dec 2008 00:03:22 +0300
> Anton Vorontsov <avorontsov@ru.mvista.com> wrote:
>
> > This patch adds support for the FHCI USB controller, as found
> > in the Freescale MPC836x and MPC832x processors. It can support
> > Full or Low speed modes.
> >
> > Quite a lot the hardware is doing by itself (SOF generation, CRC
> > generation and checking), though scheduling and retransmission is on
> > software's shoulders.
> >
> > This controller does not integrate the root hub, so this driver also
> > fakes one-port hub. External hub is required to support more than
> > one device.
> >
>
> <quick scan>
>
> Nice-looking driver. But the namespace pollution is tremendous!
Thanks for the review, Andrew.
Name-space pollution fixed.
[..]
> > +static int fhci_mem_init(struct fhci_hcd *fhci)
> > +{
> > + int i;
> > + int error = 0;
> > +
> > + fhci->hc_list = kzalloc(sizeof(*fhci->hc_list), GFP_KERNEL);
> > + if (!fhci->hc_list)
> > + return -ENOMEM;
> > +
> > + INIT_LIST_HEAD(&fhci->hc_list->ctrl_list);
> > + INIT_LIST_HEAD(&fhci->hc_list->bulk_list);
> > + INIT_LIST_HEAD(&fhci->hc_list->iso_list);
> > + INIT_LIST_HEAD(&fhci->hc_list->intr_list);
> > + INIT_LIST_HEAD(&fhci->hc_list->done_list);
> > +
> > + fhci->vroot_hub = kzalloc(sizeof(*fhci->vroot_hub), GFP_KERNEL);
> > + if (!fhci->vroot_hub)
> > + return -ENOMEM;
>
> Did we leak fhci->hc_list?
Apparently. Fixed.
[...]
> > +struct ed *get_empty_ed(struct fhci_hcd *fhci)
> > +{
> > + struct ed *ed;
> > +
> > + if (!list_empty(&fhci->empty_eds)) {
> > + ed = list_entry(fhci->empty_eds.next, struct ed, node);
> > + list_del(fhci->empty_eds.next);
> > + } else {
> > + ed = kmalloc(sizeof(*ed), GFP_ATOMIC);
> > + if (!ed)
> > + fhci_err(fhci, "No memory to allocate to ED\n");
> > + else
> > + init_ed(ed);
> > + }
> > +
> > + return ed;
> > +}
>
> The GFP_ATOMICs here are regrettable. Are these functions ever called
> from a context in which a more reliable allocation mode can be used?
> If so, the caller should pass in the gfp_t.
No, these are called with a spinlock held. But we don't normally
allocate things via this function, instead we pre-allocate the eds
and tds in the fhci_mem_init, so the kmalloc above is the last resort
when no empty tds/eds left in the appropriate lists (normally should
not happen).
Thanks,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
WARNING: multiple messages have this Message-ID (diff)
From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: greg@kroah.com, dbrownell@users.sourceforge.net,
timur@freescale.com, leoli@freescale.com,
linux-usb@vger.kernel.org, linuxppc-dev@ozlabs.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] USB: Driver for Freescale QUICC Engine USB Host Controller
Date: Wed, 24 Dec 2008 22:11:23 +0300 [thread overview]
Message-ID: <20081224191123.GA16966@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20081223132840.55e7b666.akpm@linux-foundation.org>
On Tue, Dec 23, 2008 at 01:28:40PM -0800, Andrew Morton wrote:
> On Wed, 24 Dec 2008 00:03:22 +0300
> Anton Vorontsov <avorontsov@ru.mvista.com> wrote:
>
> > This patch adds support for the FHCI USB controller, as found
> > in the Freescale MPC836x and MPC832x processors. It can support
> > Full or Low speed modes.
> >
> > Quite a lot the hardware is doing by itself (SOF generation, CRC
> > generation and checking), though scheduling and retransmission is on
> > software's shoulders.
> >
> > This controller does not integrate the root hub, so this driver also
> > fakes one-port hub. External hub is required to support more than
> > one device.
> >
>
> <quick scan>
>
> Nice-looking driver. But the namespace pollution is tremendous!
Thanks for the review, Andrew.
Name-space pollution fixed.
[..]
> > +static int fhci_mem_init(struct fhci_hcd *fhci)
> > +{
> > + int i;
> > + int error = 0;
> > +
> > + fhci->hc_list = kzalloc(sizeof(*fhci->hc_list), GFP_KERNEL);
> > + if (!fhci->hc_list)
> > + return -ENOMEM;
> > +
> > + INIT_LIST_HEAD(&fhci->hc_list->ctrl_list);
> > + INIT_LIST_HEAD(&fhci->hc_list->bulk_list);
> > + INIT_LIST_HEAD(&fhci->hc_list->iso_list);
> > + INIT_LIST_HEAD(&fhci->hc_list->intr_list);
> > + INIT_LIST_HEAD(&fhci->hc_list->done_list);
> > +
> > + fhci->vroot_hub = kzalloc(sizeof(*fhci->vroot_hub), GFP_KERNEL);
> > + if (!fhci->vroot_hub)
> > + return -ENOMEM;
>
> Did we leak fhci->hc_list?
Apparently. Fixed.
[...]
> > +struct ed *get_empty_ed(struct fhci_hcd *fhci)
> > +{
> > + struct ed *ed;
> > +
> > + if (!list_empty(&fhci->empty_eds)) {
> > + ed = list_entry(fhci->empty_eds.next, struct ed, node);
> > + list_del(fhci->empty_eds.next);
> > + } else {
> > + ed = kmalloc(sizeof(*ed), GFP_ATOMIC);
> > + if (!ed)
> > + fhci_err(fhci, "No memory to allocate to ED\n");
> > + else
> > + init_ed(ed);
> > + }
> > +
> > + return ed;
> > +}
>
> The GFP_ATOMICs here are regrettable. Are these functions ever called
> from a context in which a more reliable allocation mode can be used?
> If so, the caller should pass in the gfp_t.
No, these are called with a spinlock held. But we don't normally
allocate things via this function, instead we pre-allocate the eds
and tds in the fhci_mem_init, so the kmalloc above is the last resort
when no empty tds/eds left in the appropriate lists (normally should
not happen).
Thanks,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
next prev parent reply other threads:[~2008-12-24 19:11 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-23 21:03 [PATCH] USB: Driver for Freescale QUICC Engine USB Host Controller Anton Vorontsov
2008-12-23 21:03 ` Anton Vorontsov
2008-12-23 21:28 ` Andrew Morton
2008-12-23 21:28 ` Andrew Morton
2008-12-24 19:11 ` Anton Vorontsov [this message]
2008-12-24 19:11 ` Anton Vorontsov
2008-12-24 2:45 ` Alan Stern
2008-12-24 2:45 ` Alan Stern
2008-12-24 19:11 ` Anton Vorontsov
2008-12-24 19:11 ` Anton Vorontsov
2008-12-24 19:13 ` [PATCH -mm 1/3] USB: FHCI: Driver should be responsible for managing endpoint queues Anton Vorontsov
2008-12-24 19:13 ` Anton Vorontsov
2008-12-24 19:59 ` Greg KH
2008-12-24 19:59 ` Greg KH
2008-12-24 20:08 ` Anton Vorontsov
2008-12-24 20:08 ` Anton Vorontsov
2008-12-24 20:18 ` Andrew Morton
2008-12-24 20:18 ` Andrew Morton
2008-12-24 20:53 ` [PATCH v2] USB: Driver for Freescale QUICC Engine USB Host Controller Anton Vorontsov
2008-12-24 20:53 ` Anton Vorontsov
2008-12-24 20:58 ` [PATCH -mm 1/3] USB: FHCI: Driver should be responsible for managing endpoint queues Greg KH
2008-12-24 20:58 ` Greg KH
2008-12-24 21:07 ` Anton Vorontsov
2008-12-24 21:07 ` Anton Vorontsov
2008-12-24 22:54 ` Alan Stern
2008-12-24 22:54 ` Alan Stern
2008-12-24 19:13 ` [PATCH -mm 2/3] USB: FHCI: Fix namespace pollution Anton Vorontsov
2008-12-24 19:13 ` Anton Vorontsov
2008-12-24 19:13 ` [PATCH -mm 3/3] USB: FHCI: Fix memory leaks in fhci_mem_{init,free} Anton Vorontsov
2008-12-24 19:13 ` Anton Vorontsov
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=20081224191123.GA16966@oksana.dev.rtsoft.ru \
--to=avorontsov@ru.mvista.com \
--cc=akpm@linux-foundation.org \
--cc=dbrownell@users.sourceforge.net \
--cc=greg@kroah.com \
--cc=leoli@freescale.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=timur@freescale.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.