From stern@rowland.harvard.edu Wed Oct 11 13:29:16 2006 Date: Wed, 11 Oct 2006 16:28:46 -0400 (EDT) From: Alan Stern To: Greg KH cc: Christopher Monty Montgomery Subject: [PATCH] EHCI: fix memory pool name allocation Message-ID: 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 Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ehci-mem.c | 16 +++++----------- drivers/usb/host/ehci.h | 5 +++-- 2 files changed, 8 insertions(+), 13 deletions(-) --- gregkh-2.6.orig/drivers/usb/host/ehci-mem.c +++ gregkh-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; --- gregkh-2.6.orig/drivers/usb/host/ehci.h +++ gregkh-2.6/drivers/usb/host/ehci.h @@ -72,8 +72,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;