Skip to content

Commit f18e71c

Browse files
Ma Keaegl
authored andcommitted
EDAC/ie31200: Fix error handling in ie31200_register_mci
ie31200_register_mci() calls device_initialize() for priv->dev unconditionally. However, in the error path, put_device() is not called, leading to an imbalance. Similarly, in the unload path, put_device() is missing. Although edac_mc_free() eventually frees the memory, it does not release the device initialized by device_initialize(). For code readability and proper pairing of device_initialize()/put_device(), add put_device() calls in both error and unload paths. Found by code review. Signed-off-by: Ma Ke <make24@iscas.ac.cn> Signed-off-by: Tony Luck <tony.luck@intel.com> Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com> Link: https://patch.msgid.link/20251106084735.35017-1-make24@iscas.ac.cn
1 parent 8616025 commit f18e71c

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/edac/ie31200_edac.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ static int ie31200_register_mci(struct pci_dev *pdev, struct res_config *cfg, in
526526
ie31200_pvt.priv[mc] = priv;
527527
return 0;
528528
fail_unmap:
529+
put_device(&priv->dev);
529530
iounmap(window);
530531
fail_free:
531532
edac_mc_free(mci);
@@ -598,6 +599,7 @@ static void ie31200_unregister_mcis(void)
598599
mci = priv->mci;
599600
edac_mc_del_mc(mci->pdev);
600601
iounmap(priv->window);
602+
put_device(&priv->dev);
601603
edac_mc_free(mci);
602604
}
603605
}

0 commit comments

Comments
 (0)