aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message
diff options
context:
space:
mode:
authorMoore, Eric <Eric.Moore@lsil.com>2006-03-14 11:14:18 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-03-14 15:34:45 -0500
commitdb9c9174e42bdc8d52bc18df7c55823cf4546eda (patch)
tree8201685d53ccbd694cf706762d098716ec5f4b8b /drivers/message
parent52435430fc8724f09ad0e917eddf677583cdd45c (diff)
[SCSI] fusion - memory leak, and initializing fields
Changelog: (1) fix memory leak: p->phy_info (2) initialize device_info and port_info data fields (3) initialize the hba firmware handle (4) initialize phy_id for attached phy_info data fields (5) initialize attached phy_info data fields Signed-off-by: Eric Moore <Eric.Moore@lsil.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message')
-rw-r--r--drivers/message/fusion/mptsas.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index cea10aa50d4a..b6a6f27082b6 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -749,6 +749,9 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
749 goto out_free_consistent; 749 goto out_free_consistent;
750 } 750 }
751 751
752 if (port_info->num_phys)
753 port_info->handle =
754 le16_to_cpu(buffer->PhyData[0].ControllerDevHandle);
752 for (i = 0; i < port_info->num_phys; i++) { 755 for (i = 0; i < port_info->num_phys; i++) {
753 mptsas_print_phy_data(&buffer->PhyData[i]); 756 mptsas_print_phy_data(&buffer->PhyData[i]);
754 port_info->phy_info[i].phy_id = i; 757 port_info->phy_info[i].phy_id = i;
@@ -855,6 +858,7 @@ mptsas_sas_device_pg0(MPT_ADAPTER *ioc, struct mptsas_devinfo *device_info,
855 cfg.dir = 0; /* read */ 858 cfg.dir = 0; /* read */
856 cfg.timeout = 10; 859 cfg.timeout = 10;
857 860
861 memset(device_info, 0, sizeof(struct mptsas_devinfo));
858 error = mpt_config(ioc, &cfg); 862 error = mpt_config(ioc, &cfg);
859 if (error) 863 if (error)
860 goto out; 864 goto out;
@@ -925,6 +929,7 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info,
925 cfg.dir = 0; /* read */ 929 cfg.dir = 0; /* read */
926 cfg.timeout = 10; 930 cfg.timeout = 10;
927 931
932 memset(port_info, 0, sizeof(struct mptsas_portinfo));
928 error = mpt_config(ioc, &cfg); 933 error = mpt_config(ioc, &cfg);
929 if (error) 934 if (error)
930 goto out; 935 goto out;
@@ -1334,6 +1339,8 @@ mptsas_probe_expander_phys(MPT_ADAPTER *ioc, u32 *handle, int *index)
1334 (MPI_SAS_DEVICE_PGAD_FORM_HANDLE << 1339 (MPI_SAS_DEVICE_PGAD_FORM_HANDLE <<
1335 MPI_SAS_DEVICE_PGAD_FORM_SHIFT), 1340 MPI_SAS_DEVICE_PGAD_FORM_SHIFT),
1336 port_info->phy_info[i].attached.handle); 1341 port_info->phy_info[i].attached.handle);
1342 port_info->phy_info[i].attached.phy_id =
1343 port_info->phy_info[i].phy_id;
1337 } 1344 }
1338 1345
1339 /* 1346 /*
@@ -1360,6 +1367,7 @@ mptsas_probe_expander_phys(MPT_ADAPTER *ioc, u32 *handle, int *index)
1360 return 0; 1367 return 0;
1361 1368
1362 out_free_port_info: 1369 out_free_port_info:
1370 kfree(port_info->phy_info);
1363 kfree(port_info); 1371 kfree(port_info);
1364 out: 1372 out:
1365 return error; 1373 return error;
@@ -1485,6 +1493,7 @@ mptsas_hotplug_work(void *arg)
1485 1493
1486 if (phy_info->rphy) { 1494 if (phy_info->rphy) {
1487 sas_rphy_delete(phy_info->rphy); 1495 sas_rphy_delete(phy_info->rphy);
1496 memset(&phy_info->attached, 0, sizeof(struct mptsas_devinfo));
1488 phy_info->rphy = NULL; 1497 phy_info->rphy = NULL;
1489 } 1498 }
1490 break; 1499 break;
@@ -1955,6 +1964,8 @@ static void __devexit mptsas_remove(struct pci_dev *pdev)
1955 mutex_lock(&ioc->sas_topology_mutex); 1964 mutex_lock(&ioc->sas_topology_mutex);
1956 list_for_each_entry_safe(p, n, &ioc->sas_topology, list) { 1965 list_for_each_entry_safe(p, n, &ioc->sas_topology, list) {
1957 list_del(&p->list); 1966 list_del(&p->list);
1967 if (p->phy_info)
1968 kfree(p->phy_info);
1958 kfree(p); 1969 kfree(p);
1959 } 1970 }
1960 mutex_unlock(&ioc->sas_topology_mutex); 1971 mutex_unlock(&ioc->sas_topology_mutex);