[PATCH] EHCI: fix memory pool name allocation

From: Alan Stern
Date: Fri Nov 10 2006 - 11:19:05 EST


This patch (as802) changes the poolname allocation for the shadow
budget in ehci-mem.c. The name needs to be allocated dynamically, not
on the stack, because the memory management system continues to use it
after registration.

Also included are a couple of minor whitespace fixups (tabs instead of
spaces).

Signed-off-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

---

Andrew:

This patch has been submitted to Greg, but it's tied in with other changes
to ehci-hcd and so it might not get accepted for a while. However it does
fix a real bug in the current -mm kernel; I think you should apply it.

Alan Stern


Index: usb-2.6/drivers/usb/host/ehci.h
===================================================================
--- usb-2.6.orig/drivers/usb/host/ehci.h
+++ usb-2.6/drivers/usb/host/ehci.h
@@ -71,8 +71,9 @@ struct ehci_hcd { /* one per controlle
int next_uframe; /* scan periodic, start here */
unsigned periodic_sched; /* periodic activity count */

- kmem_cache_t *budget_pool; /* Pool for shadow budget */
- struct ehci_shadow_budget **budget; /* pointer to the shadow budget
+ char poolname[20]; /* Shadow budget pool name */
+ kmem_cache_t *budget_pool; /* Pool for shadow budget */
+ struct ehci_shadow_budget **budget; /* pointer to the shadow budget
of bandwidth placeholders */

struct ehci_fstn *periodic_restore_fstn;
Index: usb-2.6/drivers/usb/host/ehci-mem.c
===================================================================
--- usb-2.6.orig/drivers/usb/host/ehci-mem.c
+++ usb-2.6/drivers/usb/host/ehci-mem.c
@@ -293,17 +293,11 @@ static int ehci_mem_init (struct ehci_hc
goto fail;
}

- {
- char poolname[20];
-
- snprintf(poolname,20,"ehci_budget_%d",
- ehci_to_hcd(ehci)->self.busnum);
-
- ehci->budget_pool =
- kmem_cache_create (poolname,
- sizeof(struct ehci_shadow_budget),
- 0,0,NULL,NULL);
- }
+ snprintf(ehci->poolname, sizeof(ehci->poolname), "ehci-budget-%d",
+ ehci_to_hcd(ehci)->self.busnum);
+ ehci->budget_pool = kmem_cache_create(ehci->poolname,
+ sizeof(struct ehci_shadow_budget),
+ 0, 0, NULL, NULL);
if (!ehci->budget_pool)
goto fail;


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/