aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/nodemgr.c
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2005-11-07 06:31:45 -0500
committerJody McIntyre <scjody@modernduck.com>2005-11-07 06:31:45 -0500
commit8551158abc8ef45a7f473a87e69624d05ebfd684 (patch)
tree47cd79c5f5444c7cac812d797764f203207345a7 /drivers/ieee1394/nodemgr.c
parent7afa1467761f06bd9649efd66a4a6b3ff9f29a1f (diff)
kmalloc/kzalloc changes:
dv1394, eth1394, ieee1394, ohci1394, pcilynx, raw1394, sbp2c, video1394: - use kzalloc - provide safer size arguments to kmalloc and kzalloc - omit some casts Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Jody McIntyre <scjody@modernduck.com>
Diffstat (limited to 'drivers/ieee1394/nodemgr.c')
-rw-r--r--drivers/ieee1394/nodemgr.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
index 7fff5a1d2ea4..3f0917bbd7f5 100644
--- a/drivers/ieee1394/nodemgr.c
+++ b/drivers/ieee1394/nodemgr.c
@@ -743,21 +743,20 @@ static struct node_entry *nodemgr_create_node(octlet_t guid, struct csr1212_csr
743 unsigned int generation) 743 unsigned int generation)
744{ 744{
745 struct hpsb_host *host = hi->host; 745 struct hpsb_host *host = hi->host;
746 struct node_entry *ne; 746 struct node_entry *ne;
747
748 ne = kmalloc(sizeof(struct node_entry), GFP_KERNEL);
749 if (!ne) return NULL;
750 747
751 memset(ne, 0, sizeof(struct node_entry)); 748 ne = kzalloc(sizeof(*ne), GFP_KERNEL);
749 if (!ne)
750 return NULL;
752 751
753 ne->tpool = &host->tpool[nodeid & NODE_MASK]; 752 ne->tpool = &host->tpool[nodeid & NODE_MASK];
754 753
755 ne->host = host; 754 ne->host = host;
756 ne->nodeid = nodeid; 755 ne->nodeid = nodeid;
757 ne->generation = generation; 756 ne->generation = generation;
758 ne->needs_probe = 1; 757 ne->needs_probe = 1;
759 758
760 ne->guid = guid; 759 ne->guid = guid;
761 ne->guid_vendor_id = (guid >> 40) & 0xffffff; 760 ne->guid_vendor_id = (guid >> 40) & 0xffffff;
762 ne->guid_vendor_oui = nodemgr_find_oui_name(ne->guid_vendor_id); 761 ne->guid_vendor_oui = nodemgr_find_oui_name(ne->guid_vendor_id);
763 ne->csr = csr; 762 ne->csr = csr;
@@ -787,7 +786,7 @@ static struct node_entry *nodemgr_create_node(octlet_t guid, struct csr1212_csr
787 (host->node_id == nodeid) ? "Host" : "Node", 786 (host->node_id == nodeid) ? "Host" : "Node",
788 NODE_BUS_ARGS(host, nodeid), (unsigned long long)guid); 787 NODE_BUS_ARGS(host, nodeid), (unsigned long long)guid);
789 788
790 return ne; 789 return ne;
791} 790}
792 791
793 792
@@ -872,12 +871,10 @@ static struct unit_directory *nodemgr_process_unit_directory
872 struct csr1212_keyval *kv; 871 struct csr1212_keyval *kv;
873 u8 last_key_id = 0; 872 u8 last_key_id = 0;
874 873
875 ud = kmalloc(sizeof(struct unit_directory), GFP_KERNEL); 874 ud = kzalloc(sizeof(*ud), GFP_KERNEL);
876 if (!ud) 875 if (!ud)
877 goto unit_directory_error; 876 goto unit_directory_error;
878 877
879 memset (ud, 0, sizeof(struct unit_directory));
880
881 ud->ne = ne; 878 ud->ne = ne;
882 ud->ignore_driver = ignore_drivers; 879 ud->ignore_driver = ignore_drivers;
883 ud->address = ud_kv->offset + CSR1212_CONFIG_ROM_SPACE_BASE; 880 ud->address = ud_kv->offset + CSR1212_CONFIG_ROM_SPACE_BASE;
@@ -937,10 +934,10 @@ static struct unit_directory *nodemgr_process_unit_directory
937 /* Logical Unit Number */ 934 /* Logical Unit Number */
938 if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) { 935 if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) {
939 if (ud->flags & UNIT_DIRECTORY_HAS_LUN) { 936 if (ud->flags & UNIT_DIRECTORY_HAS_LUN) {
940 ud_child = kmalloc(sizeof(struct unit_directory), GFP_KERNEL); 937 ud_child = kmalloc(sizeof(*ud_child), GFP_KERNEL);
941 if (!ud_child) 938 if (!ud_child)
942 goto unit_directory_error; 939 goto unit_directory_error;
943 memcpy(ud_child, ud, sizeof(struct unit_directory)); 940 memcpy(ud_child, ud, sizeof(*ud_child));
944 nodemgr_register_device(ne, ud_child, &ne->device); 941 nodemgr_register_device(ne, ud_child, &ne->device);
945 ud_child = NULL; 942 ud_child = NULL;
946 943
@@ -1200,7 +1197,7 @@ static void nodemgr_node_scan_one(struct host_info *hi,
1200 struct csr1212_csr *csr; 1197 struct csr1212_csr *csr;
1201 struct nodemgr_csr_info *ci; 1198 struct nodemgr_csr_info *ci;
1202 1199
1203 ci = kmalloc(sizeof(struct nodemgr_csr_info), GFP_KERNEL); 1200 ci = kmalloc(sizeof(*ci), GFP_KERNEL);
1204 if (!ci) 1201 if (!ci)
1205 return; 1202 return;
1206 1203