lkml.org 
[lkml]   [2005]   [Dec]   [11]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateSun, 11 Dec 2005 14:08:43 +0100
FromGregor Jasny <>
SubjectRe: [PATCH] Reduce nr of ptr derefs in drivers/pci/hotplug/pciehp_core.c
Jesper Juhl schrieb:
> --- linux-2.6.15-rc5-git1-orig/drivers/pci/hotplug/pciehp_core.c	2005-12-04 18:48:04.000000000 +0100
> +++ linux-2.6.15-rc5-git1/drivers/pci/hotplug/pciehp_core.c	2005-12-11 05:46:58.000000000 +0100
@@ -114,59 +117,66 @@ static int init_slots(struct controller
 	slot_number = ctrl->first_slot;

 	while (number_of_slots) {
-		new_slot = kmalloc(sizeof(*new_slot), GFP_KERNEL);
-		if (!new_slot)
+		slot = kmalloc(sizeof(*slot), GFP_KERNEL);
+		if (!slot)
 			goto error;
-		memset(new_slot, 0, sizeof(struct slot));
-		new_slot->hotplug_slot =
-			kmalloc(sizeof(*(new_slot->hotplug_slot)),
+		memset(slot, 0, sizeof(struct slot));
+		slot->hotplug_slot =
+				kmalloc(sizeof(*(slot->hotplug_slot)),

Just one suggestion:

In your patches I've seen a lot of kmalloc + memset calls. Perhaps you
can convert them to kzalloc? This would improve readability even more.

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

\
 
 \ /
  Last update: 2005-12-11 14:11    [from the cache]
©2003-2008