powerpc/powermac: Use common error handling code in kw_i2c_host_init()
Subsystems (3)
PATCH 1/1 powerpc/powermac: Use common error handling code in kw_i2c_host_init()
From: Markus Elfring <[email protected]>
Date: Wed, 10 Jun 2026 19:50:08 +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 <[email protected]>
--- arch/powerpc/platforms/powermac/low_i2c.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
arch/powerpc/platforms/powermac/low_i2c.c +6 -4
@@ -504,8 +504,7 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np)if (addrp ==NULL ) {printk (KERN_ERR "low_i2c: Can't find address for %pOF\n" , np); -kfree (host); -return NULL ; + goto free_host; }mutex_init (&host->mutex);init_completion (&host->complete);
@@ -540,8 +539,7 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np)if (host->base ==NULL ) {printk (KERN_ERR "low_i2c: Can't map registers for %pOF\n" , np); -kfree (host); -return NULL ; + goto free_host; }/* Make sure IRQ is disabled */
@@ -559,6 +557,10 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np) *addrp, host->irq, np);return host; + +free_host: +kfree (host); +return NULL ; }
Signature · 1 line
2.54.0