From: Markus Elfring <[email protected]>
Date: Thu, 11 Jun 2026 11:16:49 +0200

Use an additional label so that a bit of exception handling can be better
reused at the end of an if branch.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
---
 drivers/pci/hotplug/pnv_php.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
index ff92a5c301b8..e448f1802002 100644
--- a/drivers/pci/hotplug/pnv_php.c
+++ b/drivers/pci/hotplug/pnv_php.c
@@ -791,16 +791,15 @@ static struct pnv_php_slot *pnv_php_alloc_slot(struct 
device_node *dn)
                return NULL;
 
        php_slot->name = kstrdup(label, GFP_KERNEL);
-       if (!php_slot->name) {
-               kfree(php_slot);
-               return NULL;
-       }
+       if (!php_slot->name)
+               goto free_php_slot;
 
        /* Allocate workqueue for this slot's interrupt handling */
        php_slot->wq = alloc_workqueue("pciehp-%s", WQ_PERCPU, 0, 
php_slot->name);
        if (!php_slot->wq) {
                SLOT_WARN(php_slot, "Cannot alloc workqueue\n");
                kfree(php_slot->name);
+free_php_slot:
                kfree(php_slot);
                return NULL;
        }
-- 
2.54.0


Reply via email to