Skip to contentSkip to conversation

pci: pci_alloc_bus(): use xzalloc() instead of kzalloc()

PATCH Applied Antony Pavlov 2 participants 2 messages Jul 8, 2014 – Jul 9, 2014 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci: pci_alloc_bus(): use xzalloc() instead of kzalloc()

Also drop redundant xzalloc() result check
as xzalloc() does not return in case of memory allocation error.

---
 drivers/pci/pci.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/pci/pci.c +8 -8
index ad9350f..3d88b0f 100644
@@ -16,14 +16,14 @@ static struct pci_bus *pci_alloc_bus(void)
 {
 	struct pci_bus *b;
 
-	b = kzalloc(sizeof(*b), GFP_KERNEL);
-	if (b) {
-		INIT_LIST_HEAD(&b->node);
-		INIT_LIST_HEAD(&b->children);
-		INIT_LIST_HEAD(&b->devices);
-		INIT_LIST_HEAD(&b->slots);
-		INIT_LIST_HEAD(&b->resources);
-	}
+	b = xzalloc(sizeof(*b));
+
+	INIT_LIST_HEAD(&b->node);
+	INIT_LIST_HEAD(&b->children);
+	INIT_LIST_HEAD(&b->devices);
+	INIT_LIST_HEAD(&b->slots);
+	INIT_LIST_HEAD(&b->resources);
+
 	return b;
 }
 
Signature · 7 lines
2.0.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#1 lore raw
Quoted 4 lines · Antony Pavlov

Also drop redundant xzalloc() result check
as xzalloc() does not return in case of memory allocation error.

Applied, thanks

Sascha

Quoted 40 lines
---
 drivers/pci/pci.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/pci/pci.c +8 -8
index ad9350f..3d88b0f 100644
@@ -16,14 +16,14 @@ static struct pci_bus *pci_alloc_bus(void)
 {
 	struct pci_bus *b;
 
-	b = kzalloc(sizeof(*b), GFP_KERNEL);
-	if (b) {
-		INIT_LIST_HEAD(&b->node);
-		INIT_LIST_HEAD(&b->children);
-		INIT_LIST_HEAD(&b->devices);
-		INIT_LIST_HEAD(&b->slots);
-		INIT_LIST_HEAD(&b->resources);
-	}
+	b = xzalloc(sizeof(*b));
+
+	INIT_LIST_HEAD(&b->node);
+	INIT_LIST_HEAD(&b->children);
+	INIT_LIST_HEAD(&b->devices);
+	INIT_LIST_HEAD(&b->slots);
+	INIT_LIST_HEAD(&b->resources);
+
 	return b;
 }
 
Signature · 7 lines
2.0.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox