drivers: serial: jsm: fix some leaks in probe
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 22 Sep 2022 11:22:47 +0000 (14:22 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 11:15:43 +0000 (13:15 +0200)
[ Upstream commit 1d5859ef229e381f4db38dce8ed58e4bf862006b ]

This error path needs to unwind instead of just returning directly.

Fixes: 03a8482c17dd ("drivers: serial: jsm: Enable support for Digi Classic adapters")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YyxFh1+lOeZ9WfKO@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/serial/jsm/jsm_driver.c

index a119f11bf2f4188fc76e3a4b1401d0287af00f5f..3971abb0963c6d1666de46581863b68a2d0e920c 100644 (file)
@@ -221,7 +221,8 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
                break;
        default:
-               return -ENXIO;
+               rc = -ENXIO;
+               goto out_kfree_brd;
        }
 
        rc = request_irq(brd->irq, brd->bd_ops->intr, IRQF_SHARED, "JSM", brd);