Skip to content

Commit cf90a4d

Browse files
tititiou36rleon
authored andcommitted
RDMA/bnxt_re: Fix some error handling paths in bnxt_re_probe()
If bnxt_re_add_device() fails, 'en_info' still needs to be freed, as already done in the .remove() function. The commit in Fixes incorrectly removed this call, certainly because it was expecting the .remove() function was called anyway. But if the probe fails, the remove function is not called. There is no need to call bnxt_re_remove() as it was done before, kfree() is enough. Fixes: a5e099e ("RDMA/bnxt_re: Fix an error path in bnxt_re_add_device") Signed-off-by: Christophe JAILLET <[email protected]> Link: https://patch.msgid.link/9e48ff955ae55fc39a9eb1eb590d374539eab5ba.1730477345.git.christophe.jaillet@wanadoo.fr Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 76d3ddf commit cf90a4d

File tree

1 file changed

+8
-0
lines changed
  • drivers/infiniband/hw/bnxt_re

1 file changed

+8
-0
lines changed

drivers/infiniband/hw/bnxt_re/main.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,7 +2025,15 @@ static int bnxt_re_probe(struct auxiliary_device *adev,
20252025
auxiliary_set_drvdata(adev, en_info);
20262026

20272027
rc = bnxt_re_add_device(adev, BNXT_RE_COMPLETE_INIT);
2028+
if (rc)
2029+
goto err;
2030+
mutex_unlock(&bnxt_re_mutex);
2031+
return 0;
2032+
2033+
err:
20282034
mutex_unlock(&bnxt_re_mutex);
2035+
kfree(en_info);
2036+
20292037
return rc;
20302038
}
20312039

0 commit comments

Comments
 (0)