[PATCH] EHCI: fix memory pool name allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>

---

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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux