Route unsupported provisioned features through the common error path after
vdpa_alloc_device() so the allocated device and adapter pointer are
released consistently.

Fixes: 46fc0917bbab ("vDPA/ifcvf: implement features provisioning")
Cc: [email protected] # v6.3+
Signed-off-by: Xiong Weimin <[email protected]>
---
v2:
- Add Fixes and Cc: stable tags

 drivers/vdpa/ifcvf/ifcvf_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
index ab6d6ab3b..2af1cec95 100644
--- a/drivers/vdpa/ifcvf/ifcvf_main.c
+++ b/drivers/vdpa/ifcvf/ifcvf_main.c
@@ -724,7 +724,8 @@ static int ifcvf_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, 
const char *name,
                if (config->device_features & ~device_features) {
                        IFCVF_ERR(pdev, "The provisioned features 0x%llx are 
not supported by this device with features 0x%llx\n",
                                  config->device_features, device_features);
-                       return -EINVAL;
+                       ret = -EINVAL;
+                       goto err;
                }
                device_features &= config->device_features;
        }
-- 
2.43.0


Reply via email to