From: Tanmay Bhushan <007047221b@gmail.com> Date: Tue, 27 Dec 2022 21:02:16 +0000 (+0100) Subject: vdpa: ifcvf: Do proper cleanup if IFCVF init fails X-Git-Tag: v6.1.15~189 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5d2cc32c1c10bd889125d2adc16a6bc3338dcd3e;p=platform%2Fkernel%2Flinux-riscv.git vdpa: ifcvf: Do proper cleanup if IFCVF init fails [ Upstream commit 6b04456e248761cf68f562f2fd7c04e591fcac94 ] ifcvf_mgmt_dev leaks memory if it is not freed before returning. Call is made to correct return statement so memory does not leak. ifcvf_init_hw does not take care of this so it is needed to do it here. Signed-off-by: Tanmay Bhushan <007047221b@gmail.com> Message-Id: <772e9fe133f21fa78fb98a2ebe8969efbbd58e3c.camel@gmail.com> Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang Acked-by: Zhu Lingshan Signed-off-by: Sasha Levin --- diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c index f9c0044c6442..44b29289aa19 100644 --- a/drivers/vdpa/ifcvf/ifcvf_main.c +++ b/drivers/vdpa/ifcvf/ifcvf_main.c @@ -849,7 +849,7 @@ static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id) ret = ifcvf_init_hw(vf, pdev); if (ret) { IFCVF_ERR(pdev, "Failed to init IFCVF hw\n"); - return ret; + goto err; } for (i = 0; i < vf->nr_vring; i++)