[PATCH] soundwire: intel: Use common error handling code in sdw_intel_probe_controller()
From: Markus Elfring
Date: Wed Jun 10 2026 - 05:14:02 EST
From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 10 Jun 2026 10:56:23 +0200
Use an additional label so that a bit of exception handling can be better
reused at the end of this function implementation.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/soundwire/intel_init.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c
index ad48d67fa935..8eaf62dabe55 100644
--- a/drivers/soundwire/intel_init.c
+++ b/drivers/soundwire/intel_init.c
@@ -199,10 +199,8 @@ static struct sdw_intel_ctx
* number of links is small, this is simpler than using a list to keep track of links.
*/
ctx->ldev = kzalloc_objs(*ctx->ldev, ctx->count);
- if (!ctx->ldev) {
- kfree(ctx);
- return NULL;
- }
+ if (!ctx->ldev)
+ goto free_ctx;
ctx->mmio_base = res->mmio_base;
ctx->shim_base = res->shim_base;
@@ -276,6 +274,7 @@ static struct sdw_intel_ctx
intel_link_dev_unregister(ldev);
}
kfree(ctx->ldev);
+free_ctx:
kfree(ctx);
return NULL;
}
--
2.54.0