Commit 7ec4cd3
platform: mellanox: Fix a resource leak in an error handling path in probing flow
Fix missed resource deallocation in rollback flows.
Currently if an error occurs after a successful
mlxplat_i2c_main_init(), mlxplat_i2c_main_exit() call is missed in
rollback flow.
Thus, some resources are not de-allocated.
Move mlxplat_pre_exit() call from mlxplat_remove() into
mlxplat_i2c_main_exit().
Call mlxplat_i2c_main_exit() instead of calling mlxplat_pre_exit() in
mlxplat_probe() error handling flow.
Unregister 'priv->pdev_i2c' device in mlxplat_i2c_main_init() cleanup
flow if this device was successfully registered.
Fixes: 158cd83 ("platform: mellanox: Split logic in init and exit flow")
Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Closes: https://lore.kernel.org/lkml/70165032-796e-6f5c-6748-f514e3b9d08c@linux.intel.com/T/
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20231005075616.42777-2-vadimp@nvidia.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>1 parent 0bb80ec commit 7ec4cd3
1 file changed
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6514 | 6514 | | |
6515 | 6515 | | |
6516 | 6516 | | |
| 6517 | + | |
6517 | 6518 | | |
6518 | 6519 | | |
6519 | 6520 | | |
6520 | 6521 | | |
6521 | 6522 | | |
6522 | 6523 | | |
6523 | 6524 | | |
| 6525 | + | |
6524 | 6526 | | |
6525 | 6527 | | |
6526 | 6528 | | |
| |||
6597 | 6599 | | |
6598 | 6600 | | |
6599 | 6601 | | |
6600 | | - | |
| 6602 | + | |
6601 | 6603 | | |
6602 | 6604 | | |
6603 | 6605 | | |
| |||
6614 | 6616 | | |
6615 | 6617 | | |
6616 | 6618 | | |
6617 | | - | |
6618 | 6619 | | |
6619 | 6620 | | |
6620 | 6621 | | |
| |||
0 commit comments