[PATCH] pci: pci_alloc_bus(): use xzalloc() instead of kzalloc()

Antony Pavlov antonynpavlov at gmail.com
Tue Jul 8 13:23:11 PDT 2014


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

Signed-off-by: Antony Pavlov <antonynpavlov at gmail.com>
---
 drivers/pci/pci.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index ad9350f..3d88b0f 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -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;
 }
 
-- 
2.0.1




More information about the barebox mailing list