Skip to contentSkip to conversation

PCI: pnv_php: Fix smatch warnings about "address of NULL pointer"

PATCH New [email protected] 1 participant 1 message Jan 5

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: pnv_php: Fix smatch warnings about "address of NULL pointer"

From: sunliming <[email protected]>

Fix below smatch warnings:
drivers/pci/hotplug/pnv_php.c:710 pnv_php_alloc_slot() warn: address of NULL pointer 'php_slot->bus'

---
 drivers/pci/hotplug/pnv_php.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pci/hotplug/pnv_php.c +3 -2
index c5345bff9a55..a22b8d69a479 100644
@@ -801,6 +801,9 @@ static struct pnv_php_slot *pnv_php_alloc_slot(struct device_node *dn)
 		return NULL;
 	}
 
+	php_slot->bus	                = bus;
+	php_slot->pdev	                = bus->self;
+
 	/* Allocate workqueue for this slot's interrupt handling */
 	php_slot->wq = alloc_workqueue("pciehp-%s", 0, 0, php_slot->name);
 	if (!php_slot->wq) {
@@ -818,8 +821,6 @@ static struct pnv_php_slot *pnv_php_alloc_slot(struct device_node *dn)
 	kref_init(&php_slot->kref);
 	php_slot->state	                = PNV_PHP_STATE_INITIALIZED;
 	php_slot->dn	                = dn;
-	php_slot->pdev	                = bus->self;
-	php_slot->bus	                = bus;
 	php_slot->id	                = id;
 	php_slot->power_state_check     = false;
 	php_slot->slot.ops              = &php_slot_ops;
Signature · 1 line
2.25.1