aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vme/bridges
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2012-08-21 00:17:34 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-06 16:29:11 -0400
commit43f5e46c8e74046a969a3811d7760d1988a8f4bf (patch)
tree1d4f49197feaf0cd667703fe930c15da4e81f566 /drivers/vme/bridges
parentb49c32ba2ca3b51ddbb863ff139adca6b85b7543 (diff)
vme: vme_ca91cx42.c: 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(). We should use the safe macro if the loop involves deletions of items. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/vme/bridges')
-rw-r--r--drivers/vme/bridges/vme_ca91cx42.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/vme/bridges/vme_ca91cx42.c b/drivers/vme/bridges/vme_ca91cx42.c
index e0df92ec44bd..1425d22cf956 100644
--- a/drivers/vme/bridges/vme_ca91cx42.c
+++ b/drivers/vme/bridges/vme_ca91cx42.c
@@ -1603,7 +1603,7 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1603{ 1603{
1604 int retval, i; 1604 int retval, i;
1605 u32 data; 1605 u32 data;
1606 struct list_head *pos = NULL; 1606 struct list_head *pos = NULL, *n;
1607 struct vme_bridge *ca91cx42_bridge; 1607 struct vme_bridge *ca91cx42_bridge;
1608 struct ca91cx42_driver *ca91cx42_device; 1608 struct ca91cx42_driver *ca91cx42_device;
1609 struct vme_master_resource *master_image; 1609 struct vme_master_resource *master_image;
@@ -1821,28 +1821,28 @@ err_reg:
1821 ca91cx42_crcsr_exit(ca91cx42_bridge, pdev); 1821 ca91cx42_crcsr_exit(ca91cx42_bridge, pdev);
1822err_lm: 1822err_lm:
1823 /* resources are stored in link list */ 1823 /* resources are stored in link list */
1824 list_for_each(pos, &ca91cx42_bridge->lm_resources) { 1824 list_for_each_safe(pos, n, &ca91cx42_bridge->lm_resources) {
1825 lm = list_entry(pos, struct vme_lm_resource, list); 1825 lm = list_entry(pos, struct vme_lm_resource, list);
1826 list_del(pos); 1826 list_del(pos);
1827 kfree(lm); 1827 kfree(lm);
1828 } 1828 }
1829err_dma: 1829err_dma:
1830 /* resources are stored in link list */ 1830 /* resources are stored in link list */
1831 list_for_each(pos, &ca91cx42_bridge->dma_resources) { 1831 list_for_each_safe(pos, n, &ca91cx42_bridge->dma_resources) {
1832 dma_ctrlr = list_entry(pos, struct vme_dma_resource, list); 1832 dma_ctrlr = list_entry(pos, struct vme_dma_resource, list);
1833 list_del(pos); 1833 list_del(pos);
1834 kfree(dma_ctrlr); 1834 kfree(dma_ctrlr);
1835 } 1835 }
1836err_slave: 1836err_slave:
1837 /* resources are stored in link list */ 1837 /* resources are stored in link list */
1838 list_for_each(pos, &ca91cx42_bridge->slave_resources) { 1838 list_for_each_safe(pos, n, &ca91cx42_bridge->slave_resources) {
1839 slave_image = list_entry(pos, struct vme_slave_resource, list); 1839 slave_image = list_entry(pos, struct vme_slave_resource, list);
1840 list_del(pos); 1840 list_del(pos);
1841 kfree(slave_image); 1841 kfree(slave_image);
1842 } 1842 }
1843err_master: 1843err_master:
1844 /* resources are stored in link list */ 1844 /* resources are stored in link list */
1845 list_for_each(pos, &ca91cx42_bridge->master_resources) { 1845 list_for_each_safe(pos, n, &ca91cx42_bridge->master_resources) {
1846 master_image = list_entry(pos, struct vme_master_resource, 1846 master_image = list_entry(pos, struct vme_master_resource,
1847 list); 1847 list);
1848 list_del(pos); 1848 list_del(pos);
@@ -1868,7 +1868,7 @@ err_struct:
1868 1868
1869static void ca91cx42_remove(struct pci_dev *pdev) 1869static void ca91cx42_remove(struct pci_dev *pdev)
1870{ 1870{
1871 struct list_head *pos = NULL; 1871 struct list_head *pos = NULL, *n;
1872 struct vme_master_resource *master_image; 1872 struct vme_master_resource *master_image;
1873 struct vme_slave_resource *slave_image; 1873 struct vme_slave_resource *slave_image;
1874 struct vme_dma_resource *dma_ctrlr; 1874 struct vme_dma_resource *dma_ctrlr;
@@ -1905,28 +1905,28 @@ static void ca91cx42_remove(struct pci_dev *pdev)
1905 ca91cx42_crcsr_exit(ca91cx42_bridge, pdev); 1905 ca91cx42_crcsr_exit(ca91cx42_bridge, pdev);
1906 1906
1907 /* resources are stored in link list */ 1907 /* resources are stored in link list */
1908 list_for_each(pos, &ca91cx42_bridge->lm_resources) { 1908 list_for_each_safe(pos, n, &ca91cx42_bridge->lm_resources) {
1909 lm = list_entry(pos, struct vme_lm_resource, list); 1909 lm = list_entry(pos, struct vme_lm_resource, list);
1910 list_del(pos); 1910 list_del(pos);
1911 kfree(lm); 1911 kfree(lm);
1912 } 1912 }
1913 1913
1914 /* resources are stored in link list */ 1914 /* resources are stored in link list */
1915 list_for_each(pos, &ca91cx42_bridge->dma_resources) { 1915 list_for_each_safe(pos, n, &ca91cx42_bridge->dma_resources) {
1916 dma_ctrlr = list_entry(pos, struct vme_dma_resource, list); 1916 dma_ctrlr = list_entry(pos, struct vme_dma_resource, list);
1917 list_del(pos); 1917 list_del(pos);
1918 kfree(dma_ctrlr); 1918 kfree(dma_ctrlr);
1919 } 1919 }
1920 1920
1921 /* resources are stored in link list */ 1921 /* resources are stored in link list */
1922 list_for_each(pos, &ca91cx42_bridge->slave_resources) { 1922 list_for_each_safe(pos, n, &ca91cx42_bridge->slave_resources) {
1923 slave_image = list_entry(pos, struct vme_slave_resource, list); 1923 slave_image = list_entry(pos, struct vme_slave_resource, list);
1924 list_del(pos); 1924 list_del(pos);
1925 kfree(slave_image); 1925 kfree(slave_image);
1926 } 1926 }
1927 1927
1928 /* resources are stored in link list */ 1928 /* resources are stored in link list */
1929 list_for_each(pos, &ca91cx42_bridge->master_resources) { 1929 list_for_each_safe(pos, n, &ca91cx42_bridge->master_resources) {
1930 master_image = list_entry(pos, struct vme_master_resource, 1930 master_image = list_entry(pos, struct vme_master_resource,
1931 list); 1931 list);
1932 list_del(pos); 1932 list_del(pos);