[2/3] can: cc770: add missing free_cc770dev() in cc770_isa_probe()

Message ID 1668168557-6024-1-git-send-email-zhangchangzhong@huawei.com
State New
Headers
Series [1/3] can: sja1000_isa: add missing free_sja1000dev() in sja1000_isa_probe() |

Commit Message

Zhang Changzhong Nov. 11, 2022, 12:09 p.m. UTC
  Add the missing free_cc770dev() before return from cc770_isa_probe() in
the register_cc770dev() error handling case.

In addition, remove blanks before goto labels.

Fixes: 7e02e5433e00 ("can: cc770: legacy CC770 ISA bus driver")
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
---
 drivers/net/can/cc770/cc770_isa.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
  

Comments

Marc Kleine-Budde Nov. 24, 2022, 3:08 p.m. UTC | #1
On 11.11.2022 20:09:16, Zhang Changzhong wrote:
> Add the missing free_cc770dev() before return from cc770_isa_probe() in
> the register_cc770dev() error handling case.
> 
> In addition, remove blanks before goto labels.
> 
> Fixes: 7e02e5433e00 ("can: cc770: legacy CC770 ISA bus driver")
> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>

Applied to linux-can.

Thanks,
Marc
  

Patch

diff --git a/drivers/net/can/cc770/cc770_isa.c b/drivers/net/can/cc770/cc770_isa.c
index 194c86e..8f6dccd 100644
--- a/drivers/net/can/cc770/cc770_isa.c
+++ b/drivers/net/can/cc770/cc770_isa.c
@@ -264,22 +264,24 @@  static int cc770_isa_probe(struct platform_device *pdev)
 	if (err) {
 		dev_err(&pdev->dev,
 			"couldn't register device (err=%d)\n", err);
-		goto exit_unmap;
+		goto exit_free;
 	}
 
 	dev_info(&pdev->dev, "device registered (reg_base=0x%p, irq=%d)\n",
 		 priv->reg_base, dev->irq);
 	return 0;
 
- exit_unmap:
+exit_free:
+	free_cc770dev(dev);
+exit_unmap:
 	if (mem[idx])
 		iounmap(base);
- exit_release:
+exit_release:
 	if (mem[idx])
 		release_mem_region(mem[idx], iosize);
 	else
 		release_region(port[idx], iosize);
- exit:
+exit:
 	return err;
 }