aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi_debug.c')
-rw-r--r--drivers/scsi/scsi_debug.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 0e529f8171c4..5a5d2af8ee43 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -1061,13 +1061,12 @@ static struct sdebug_dev_info * devInfoReg(struct scsi_device * sdev)
1061 } 1061 }
1062 } 1062 }
1063 if (NULL == open_devip) { /* try and make a new one */ 1063 if (NULL == open_devip) { /* try and make a new one */
1064 open_devip = kmalloc(sizeof(*open_devip),GFP_KERNEL); 1064 open_devip = kzalloc(sizeof(*open_devip),GFP_KERNEL);
1065 if (NULL == open_devip) { 1065 if (NULL == open_devip) {
1066 printk(KERN_ERR "%s: out of memory at line %d\n", 1066 printk(KERN_ERR "%s: out of memory at line %d\n",
1067 __FUNCTION__, __LINE__); 1067 __FUNCTION__, __LINE__);
1068 return NULL; 1068 return NULL;
1069 } 1069 }
1070 memset(open_devip, 0, sizeof(*open_devip));
1071 open_devip->sdbg_host = sdbg_host; 1070 open_devip->sdbg_host = sdbg_host;
1072 list_add_tail(&open_devip->dev_list, 1071 list_add_tail(&open_devip->dev_list,
1073 &sdbg_host->dev_info_list); 1072 &sdbg_host->dev_info_list);
@@ -1814,7 +1813,7 @@ static int sdebug_add_adapter(void)
1814 struct sdebug_dev_info *sdbg_devinfo; 1813 struct sdebug_dev_info *sdbg_devinfo;
1815 struct list_head *lh, *lh_sf; 1814 struct list_head *lh, *lh_sf;
1816 1815
1817 sdbg_host = kmalloc(sizeof(*sdbg_host),GFP_KERNEL); 1816 sdbg_host = kzalloc(sizeof(*sdbg_host), GFP_KERNEL);
1818 1817
1819 if (NULL == sdbg_host) { 1818 if (NULL == sdbg_host) {
1820 printk(KERN_ERR "%s: out of memory at line %d\n", 1819 printk(KERN_ERR "%s: out of memory at line %d\n",
@@ -1822,19 +1821,17 @@ static int sdebug_add_adapter(void)
1822 return -ENOMEM; 1821 return -ENOMEM;
1823 } 1822 }
1824 1823
1825 memset(sdbg_host, 0, sizeof(*sdbg_host));
1826 INIT_LIST_HEAD(&sdbg_host->dev_info_list); 1824 INIT_LIST_HEAD(&sdbg_host->dev_info_list);
1827 1825
1828 devs_per_host = scsi_debug_num_tgts * scsi_debug_max_luns; 1826 devs_per_host = scsi_debug_num_tgts * scsi_debug_max_luns;
1829 for (k = 0; k < devs_per_host; k++) { 1827 for (k = 0; k < devs_per_host; k++) {
1830 sdbg_devinfo = kmalloc(sizeof(*sdbg_devinfo),GFP_KERNEL); 1828 sdbg_devinfo = kzalloc(sizeof(*sdbg_devinfo), GFP_KERNEL);
1831 if (NULL == sdbg_devinfo) { 1829 if (NULL == sdbg_devinfo) {
1832 printk(KERN_ERR "%s: out of memory at line %d\n", 1830 printk(KERN_ERR "%s: out of memory at line %d\n",
1833 __FUNCTION__, __LINE__); 1831 __FUNCTION__, __LINE__);
1834 error = -ENOMEM; 1832 error = -ENOMEM;
1835 goto clean; 1833 goto clean;
1836 } 1834 }
1837 memset(sdbg_devinfo, 0, sizeof(*sdbg_devinfo));
1838 sdbg_devinfo->sdbg_host = sdbg_host; 1835 sdbg_devinfo->sdbg_host = sdbg_host;
1839 list_add_tail(&sdbg_devinfo->dev_list, 1836 list_add_tail(&sdbg_devinfo->dev_list,
1840 &sdbg_host->dev_info_list); 1837 &sdbg_host->dev_info_list);