drivers: net: ionic: add missed debugfs cleanup to ionic_probe() error path

[ Upstream commit 71712cf519faeed529549a79559c06c7fc250a15 ]

The ionic_setup_one() creates a debugfs entry for ionic upon
successful execution. However, the ionic_probe() does not
release the dentry before returning, resulting in a memory
leak.

To fix this bug, we add the ionic_debugfs_del_dev() to release
the resources in a timely manner before returning.

Fixes: 0de38d9f1d ("ionic: extract common bits from ionic_probe")
Signed-off-by: Wentao Liang <Wentao_liang_g@163.com>
Acked-by: Shannon Nelson <shannon.nelson@amd.com>
Link: https://patch.msgid.link/20241107021756.1677-1-liangwentao@iscas.ac.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Wentao Liang 2024-11-07 10:17:56 +08:00 committed by Greg Kroah-Hartman
parent 996a7208da
commit 1947143cb1

View file

@ -385,6 +385,7 @@ err_out_free_irqs:
err_out_pci: err_out_pci:
ionic_dev_teardown(ionic); ionic_dev_teardown(ionic);
ionic_clear_pci(ionic); ionic_clear_pci(ionic);
ionic_debugfs_del_dev(ionic);
err_out: err_out:
mutex_destroy(&ionic->dev_cmd_lock); mutex_destroy(&ionic->dev_cmd_lock);
ionic_devlink_free(ionic); ionic_devlink_free(ionic);