All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: pnv_php: Fix smatch warnings about "address of NULL pointer"
@ 2026-01-05 12:23 sunliming
  0 siblings, 0 replies; only message in thread
From: sunliming @ 2026-01-05 12:23 UTC (permalink / raw)
  To: maddy, mpe
  Cc: npiggin, chleroy, bhelgaas, linuxppc-dev, linux-pci, linux-kernel,
	sunliming, kernel test robot, Dan Carpenter

From: sunliming <sunliming@kylinos.cn>

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

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/r/202601050123.5JEZ4Znh-lkp@intel.com/
Signed-off-by: sunliming <sunliming@kylinos.cn>
---
 drivers/pci/hotplug/pnv_php.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
index c5345bff9a55..a22b8d69a479 100644
--- a/drivers/pci/hotplug/pnv_php.c
+++ b/drivers/pci/hotplug/pnv_php.c
@@ -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;
-- 
2.25.1


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

only message in thread, other threads:[~2026-01-05 12:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-05 12:23 [PATCH] PCI: pnv_php: Fix smatch warnings about "address of NULL pointer" sunliming

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.