can: cc770: cc770_isa_probe(): add missing free_cc770dev()
authorZhang Changzhong <zhangchangzhong@huawei.com>
Fri, 11 Nov 2022 12:09:16 +0000 (20:09 +0800)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 24 Nov 2022 15:09:53 +0000 (16:09 +0100)
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>
Link: https://lore.kernel.org/all/1668168557-6024-1-git-send-email-zhangchangzhong@huawei.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/cc770/cc770_isa.c

index 194c86e0f340fb873965ce05f543f09b4c314482..8f6dccd5a58792fc143cb462e176c9a2fdd4c69b 100644 (file)
@@ -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;
 }