> > - kfree(madev); > I think you can just avoid using add_fail and keep/retain rest of init_fail, > idx_fail > conditions in old way right?
I do agree with Sai. I think the patch can be just:
@@ -2797,7 +2797,8 @@ static int add_adev(struct gdma_dev *gd)
ret = auxiliary_device_init(adev);
if (ret)
goto init_fail;
-
+ /* madev is owned by the auxiliary device */
+ madev = NULL;
ret = auxiliary_device_add(adev);
if (ret)
goto add_fail;
- Konstantin
