Commit ef1b6d90 authored by Ma Ke's avatar Ma Ke Committed by Tony Luck
Browse files

EDAC/igen6: Fix error handling in igen6_edac driver



The igen6_edac driver calls device_initialize() for all memory
controllers in igen6_register_mci(), but misses corresponding
put_device() calls in error paths and during normal shutdown in
igen6_unregister_mcis().

Adding the missing put_device() calls improves code readability and
ensures proper reference counting for the device structure.

Found by code review.

Signed-off-by: default avatarMa Ke <make24@iscas.ac.cn>
Reviewed-by: default avatarQiuxu Zhuo <qiuxu.zhuo@intel.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
Link: https://patch.msgid.link/20251105090244.23327-1-make24@iscas.ac.cn
parent 5f40ea7f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1300,6 +1300,7 @@ static int igen6_register_mci(int mc, void __iomem *window, struct pci_dev *pdev
	imc->mci = mci;
	return 0;
fail3:
	put_device(&imc->dev);
	mci->pvt_info = NULL;
	kfree(mci->ctl_name);
fail2:
@@ -1326,6 +1327,7 @@ static void igen6_unregister_mcis(void)
		kfree(mci->ctl_name);
		mci->pvt_info = NULL;
		edac_mc_free(mci);
		put_device(&imc->dev);
		iounmap(imc->window);
	}
}