diff options
author | Roland Dreier <rolandd@cisco.com> | 2005-11-02 10:23:14 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2005-11-02 10:23:14 -0500 |
commit | de6eb66b56d9df5ce6bd254994f05e065214e8cd (patch) | |
tree | 7463446a05b5e9a5d2fc400da0be8d4a6c2ff6f1 /drivers/infiniband/core/sysfs.c | |
parent | 7b28b0d000eeb62d77add636f5d6eb0da04e48aa (diff) |
[IB] kzalloc() conversions
Replace kmalloc()+memset(,0,) with kzalloc(), for a net savings of 35
source lines and about 500 bytes of text.
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/core/sysfs.c')
-rw-r--r-- | drivers/infiniband/core/sysfs.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 7ce7a6c782fa..b8120650e711 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c | |||
@@ -307,14 +307,13 @@ static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr, | |||
307 | if (!p->ibdev->process_mad) | 307 | if (!p->ibdev->process_mad) |
308 | return sprintf(buf, "N/A (no PMA)\n"); | 308 | return sprintf(buf, "N/A (no PMA)\n"); |
309 | 309 | ||
310 | in_mad = kmalloc(sizeof *in_mad, GFP_KERNEL); | 310 | in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); |
311 | out_mad = kmalloc(sizeof *in_mad, GFP_KERNEL); | 311 | out_mad = kmalloc(sizeof *in_mad, GFP_KERNEL); |
312 | if (!in_mad || !out_mad) { | 312 | if (!in_mad || !out_mad) { |
313 | ret = -ENOMEM; | 313 | ret = -ENOMEM; |
314 | goto out; | 314 | goto out; |
315 | } | 315 | } |
316 | 316 | ||
317 | memset(in_mad, 0, sizeof *in_mad); | ||
318 | in_mad->mad_hdr.base_version = 1; | 317 | in_mad->mad_hdr.base_version = 1; |
319 | in_mad->mad_hdr.mgmt_class = IB_MGMT_CLASS_PERF_MGMT; | 318 | in_mad->mad_hdr.mgmt_class = IB_MGMT_CLASS_PERF_MGMT; |
320 | in_mad->mad_hdr.class_version = 1; | 319 | in_mad->mad_hdr.class_version = 1; |
@@ -508,10 +507,9 @@ static int add_port(struct ib_device *device, int port_num) | |||
508 | if (ret) | 507 | if (ret) |
509 | return ret; | 508 | return ret; |
510 | 509 | ||
511 | p = kmalloc(sizeof *p, GFP_KERNEL); | 510 | p = kzalloc(sizeof *p, GFP_KERNEL); |
512 | if (!p) | 511 | if (!p) |
513 | return -ENOMEM; | 512 | return -ENOMEM; |
514 | memset(p, 0, sizeof *p); | ||
515 | 513 | ||
516 | p->ibdev = device; | 514 | p->ibdev = device; |
517 | p->port_num = port_num; | 515 | p->port_num = port_num; |