mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [TRIVIAL] Handle kmalloc fails: drivers_pci_probe.c
@ 2003-01-06  4:00 Rusty Trivial Russell
  0 siblings, 0 replies; only message in thread
From: Rusty Trivial Russell @ 2003-01-06  4:00 UTC (permalink / raw)
  To: torvalds, linux-kernel

[ Looks trivially correct --RR ]
From:  Pablo Menichini <pablo@menichini.com.ar>

  Best regards,
          Pablo
  

--- trivial-2.5-bk/drivers/pci/probe.c.orig	2003-01-06 14:10:57.000000000 +1100
+++ trivial-2.5-bk/drivers/pci/probe.c	2003-01-06 14:10:57.000000000 +1100
@@ -558,9 +558,15 @@
 	b = pci_alloc_bus();
 	if (!b)
 		return NULL;
+	
+	b->dev = kmalloc(sizeof(*(b->dev)),GFP_KERNEL);
+	if (!b->dev){
+		kfree(b);
+		return NULL;
+	}
+	
 	list_add_tail(&b->node, &pci_root_buses);
 
-	b->dev = kmalloc(sizeof(*(b->dev)),GFP_KERNEL);
 	memset(b->dev,0,sizeof(*(b->dev)));
 	sprintf(b->dev->bus_id,"pci%d",bus);
 	strcpy(b->dev->name,"Host/PCI Bridge");
-- 
  Don't blame me: the Monkey is driving
  File: Pablo Menichini <pablo@menichini.com.ar>: [PATCH][2.5.53] Handle kmalloc fails: drivers_pci_probe.c

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-01-06  4:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-06  4:00 [TRIVIAL] Handle kmalloc fails: drivers_pci_probe.c Rusty Trivial Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome