* [PATCH] PCI: pnv_php: Use common error handling code in pnv_php_alloc_slot()
@ 2026-06-11 9:25 Markus Elfring
2026-06-22 15:58 ` Manivannan Sadhasivam
0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2026-06-11 9:25 UTC (permalink / raw)
To: linux-pci, linuxppc-dev, Bjorn Helgaas, Christophe Leroy,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin
Cc: LKML, kernel-janitors, Ilpo Järvinen, Jonathan Cameron,
Krzysztof Kozlowski
From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] PCI: pnv_php: Use common error handling code in pnv_php_alloc_slot()
2026-06-11 9:25 [PATCH] PCI: pnv_php: Use common error handling code in pnv_php_alloc_slot() Markus Elfring
@ 2026-06-22 15:58 ` Manivannan Sadhasivam
0 siblings, 0 replies; 2+ messages in thread
From: Manivannan Sadhasivam @ 2026-06-22 15:58 UTC (permalink / raw)
To: Markus Elfring
Cc: linux-pci, linuxppc-dev, Bjorn Helgaas, Christophe Leroy,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin, LKML,
kernel-janitors, Ilpo Järvinen, Jonathan Cameron,
Krzysztof Kozlowski
On Thu, Jun 11, 2026 at 11:25:12AM +0200, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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 <elfring@users.sourceforge.net>
> ---
> 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:
Really? What kind of coding practice is this?
- Mani
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-22 15:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-11 9:25 [PATCH] PCI: pnv_php: Use common error handling code in pnv_php_alloc_slot() Markus Elfring
2026-06-22 15:58 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®