Skip to content

Commit ef1b6d9

Browse files
Ma Keaegl
authored andcommitted
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: Ma Ke <make24@iscas.ac.cn> Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com> Signed-off-by: Tony Luck <tony.luck@intel.com> Link: https://patch.msgid.link/20251105090244.23327-1-make24@iscas.ac.cn
1 parent 5f40ea7 commit ef1b6d9

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/edac/igen6_edac.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,6 +1300,7 @@ static int igen6_register_mci(int mc, void __iomem *window, struct pci_dev *pdev
13001300
imc->mci = mci;
13011301
return 0;
13021302
fail3:
1303+
put_device(&imc->dev);
13031304
mci->pvt_info = NULL;
13041305
kfree(mci->ctl_name);
13051306
fail2:
@@ -1326,6 +1327,7 @@ static void igen6_unregister_mcis(void)
13261327
kfree(mci->ctl_name);
13271328
mci->pvt_info = NULL;
13281329
edac_mc_free(mci);
1330+
put_device(&imc->dev);
13291331
iounmap(imc->window);
13301332
}
13311333
}

0 commit comments

Comments
 (0)