diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2012-08-21 00:19:01 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-06 16:29:11 -0400 |
commit | b49c32ba2ca3b51ddbb863ff139adca6b85b7543 (patch) | |
tree | abe16b7e414678d20a5f70b554c70db04f5164dc /drivers/vme | |
parent | 1b8cb9290671a4c025c16a51d316031f9ec04976 (diff) |
vme: vme_tsi148.c: fix to use list_for_each_safe() when delete list items
Since we will be removing items off the list using list_del() we need
to use a safer version of the list_for_each() macro aptly named
list_for_each_safe().
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/vme')
-rw-r--r-- | drivers/vme/bridges/vme_tsi148.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/vme/bridges/vme_tsi148.c index 880d9242e34..5fbd08ffb9c 100644 --- a/drivers/vme/bridges/vme_tsi148.c +++ b/drivers/vme/bridges/vme_tsi148.c | |||
@@ -2350,7 +2350,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
2350 | { | 2350 | { |
2351 | int retval, i, master_num; | 2351 | int retval, i, master_num; |
2352 | u32 data; | 2352 | u32 data; |
2353 | struct list_head *pos = NULL; | 2353 | struct list_head *pos = NULL, *n; |
2354 | struct vme_bridge *tsi148_bridge; | 2354 | struct vme_bridge *tsi148_bridge; |
2355 | struct tsi148_driver *tsi148_device; | 2355 | struct tsi148_driver *tsi148_device; |
2356 | struct vme_master_resource *master_image; | 2356 | struct vme_master_resource *master_image; |
@@ -2615,28 +2615,28 @@ err_reg: | |||
2615 | err_crcsr: | 2615 | err_crcsr: |
2616 | err_lm: | 2616 | err_lm: |
2617 | /* resources are stored in link list */ | 2617 | /* resources are stored in link list */ |
2618 | list_for_each(pos, &tsi148_bridge->lm_resources) { | 2618 | list_for_each_safe(pos, n, &tsi148_bridge->lm_resources) { |
2619 | lm = list_entry(pos, struct vme_lm_resource, list); | 2619 | lm = list_entry(pos, struct vme_lm_resource, list); |
2620 | list_del(pos); | 2620 | list_del(pos); |
2621 | kfree(lm); | 2621 | kfree(lm); |
2622 | } | 2622 | } |
2623 | err_dma: | 2623 | err_dma: |
2624 | /* resources are stored in link list */ | 2624 | /* resources are stored in link list */ |
2625 | list_for_each(pos, &tsi148_bridge->dma_resources) { | 2625 | list_for_each_safe(pos, n, &tsi148_bridge->dma_resources) { |
2626 | dma_ctrlr = list_entry(pos, struct vme_dma_resource, list); | 2626 | dma_ctrlr = list_entry(pos, struct vme_dma_resource, list); |
2627 | list_del(pos); | 2627 | list_del(pos); |
2628 | kfree(dma_ctrlr); | 2628 | kfree(dma_ctrlr); |
2629 | } | 2629 | } |
2630 | err_slave: | 2630 | err_slave: |
2631 | /* resources are stored in link list */ | 2631 | /* resources are stored in link list */ |
2632 | list_for_each(pos, &tsi148_bridge->slave_resources) { | 2632 | list_for_each_safe(pos, n, &tsi148_bridge->slave_resources) { |
2633 | slave_image = list_entry(pos, struct vme_slave_resource, list); | 2633 | slave_image = list_entry(pos, struct vme_slave_resource, list); |
2634 | list_del(pos); | 2634 | list_del(pos); |
2635 | kfree(slave_image); | 2635 | kfree(slave_image); |
2636 | } | 2636 | } |
2637 | err_master: | 2637 | err_master: |
2638 | /* resources are stored in link list */ | 2638 | /* resources are stored in link list */ |
2639 | list_for_each(pos, &tsi148_bridge->master_resources) { | 2639 | list_for_each_safe(pos, n, &tsi148_bridge->master_resources) { |
2640 | master_image = list_entry(pos, struct vme_master_resource, | 2640 | master_image = list_entry(pos, struct vme_master_resource, |
2641 | list); | 2641 | list); |
2642 | list_del(pos); | 2642 | list_del(pos); |