Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ghes_edac: fix to use list_for_each_entry_safe() when delete list items

Since we will remove items off the list using list_del() we need
to use a safe version of the list_for_each_entry() macro aptly named
list_for_each_entry_safe().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Wei Yongjun and committed by
Mauro Carvalho Chehab
5dae92a7 8ae8f50a

+2 -2
+2 -2
drivers/edac/ghes_edac.c
··· 523 523 void ghes_edac_unregister(struct ghes *ghes) 524 524 { 525 525 struct mem_ctl_info *mci; 526 - struct ghes_edac_pvt *pvt; 526 + struct ghes_edac_pvt *pvt, *tmp; 527 527 528 - list_for_each_entry(pvt, &ghes_reglist, list) { 528 + list_for_each_entry_safe(pvt, tmp, &ghes_reglist, list) { 529 529 if (ghes == pvt->ghes) { 530 530 mci = pvt->mci; 531 531 edac_mc_del_mc(mci->pdev);