X86 platform drivers
 help / color / mirror / Atom feed
* [PATCH] platform: mellanox: Fix a resource leak in an error handling path in mlxplat_probe()
@ 2023-10-01  6:20 Christophe JAILLET
  2023-10-03 12:05 ` Ilpo Järvinen
  0 siblings, 1 reply; 5+ messages in thread
From: Christophe JAILLET @ 2023-10-01  6:20 UTC (permalink / raw)
  To: Vadim Pasternak, Hans de Goede, Ilpo Järvinen, Mark Gross,
	Michael Shych
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET,
	platform-driver-x86

If an error occurs after a successful mlxplat_i2c_main_init(),
mlxplat_i2c_main_exit() should be called to free some resources.

Add the missing call, as already done in the remove function.

Fixes: 158cd8320776 ("platform: mellanox: Split logic in init and exit flow")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is based on comparison between functions called in the remove
function and the error handling path of the probe.

For some reason, the way the code is written and function names are
puzzling to me. So Review with care!
---
 drivers/platform/x86/mlx-platform.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c
index 3d96dbf79a72..64701b63336e 100644
--- a/drivers/platform/x86/mlx-platform.c
+++ b/drivers/platform/x86/mlx-platform.c
@@ -6598,6 +6598,7 @@ static int mlxplat_probe(struct platform_device *pdev)
 fail_register_reboot_notifier:
 fail_regcache_sync:
 	mlxplat_pre_exit(priv);
+	mlxplat_i2c_main_exit(priv);
 fail_mlxplat_i2c_main_init:
 fail_regmap_write:
 fail_alloc:
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-10-05 14:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-01  6:20 [PATCH] platform: mellanox: Fix a resource leak in an error handling path in mlxplat_probe() Christophe JAILLET
2023-10-03 12:05 ` Ilpo Järvinen
2023-10-03 14:44   ` Vadim Pasternak
2023-10-04  8:51     ` Ilpo Järvinen
2023-10-05  8:13       ` Vadim Pasternak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox