Skip to content

Commit

Permalink
Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/g…
Browse files Browse the repository at this point in the history
…it/roland/infiniband
  • Loading branch information
Linus Torvalds committed Nov 5, 2005
2 parents 602d4a7 + d09e327 commit ba77df5
Show file tree
Hide file tree
Showing 25 changed files with 178 additions and 124 deletions.
3 changes: 1 addition & 2 deletions drivers/infiniband/core/agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,12 @@ int ib_agent_port_open(struct ib_device *device, int port_num)
int ret;

/* Create new device info */
port_priv = kmalloc(sizeof *port_priv, GFP_KERNEL);
port_priv = kzalloc(sizeof *port_priv, GFP_KERNEL);
if (!port_priv) {
printk(KERN_ERR SPFX "No memory for ib_agent_port_private\n");
ret = -ENOMEM;
goto error1;
}
memset(port_priv, 0, sizeof *port_priv);

/* Obtain send only MAD agent for SMI QP */
port_priv->agent[0] = ib_register_mad_agent(device, port_num,
Expand Down
6 changes: 2 additions & 4 deletions drivers/infiniband/core/cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,11 +544,10 @@ struct ib_cm_id *ib_create_cm_id(struct ib_device *device,
struct cm_id_private *cm_id_priv;
int ret;

cm_id_priv = kmalloc(sizeof *cm_id_priv, GFP_KERNEL);
cm_id_priv = kzalloc(sizeof *cm_id_priv, GFP_KERNEL);
if (!cm_id_priv)
return ERR_PTR(-ENOMEM);

memset(cm_id_priv, 0, sizeof *cm_id_priv);
cm_id_priv->id.state = IB_CM_IDLE;
cm_id_priv->id.device = device;
cm_id_priv->id.cm_handler = cm_handler;
Expand Down Expand Up @@ -621,10 +620,9 @@ static struct cm_timewait_info * cm_create_timewait_info(__be32 local_id)
{
struct cm_timewait_info *timewait_info;

timewait_info = kmalloc(sizeof *timewait_info, GFP_KERNEL);
timewait_info = kzalloc(sizeof *timewait_info, GFP_KERNEL);
if (!timewait_info)
return ERR_PTR(-ENOMEM);
memset(timewait_info, 0, sizeof *timewait_info);

timewait_info->work.local_id = local_id;
INIT_WORK(&timewait_info->work.work, cm_work_handler,
Expand Down
10 changes: 1 addition & 9 deletions drivers/infiniband/core/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,9 @@ static int alloc_name(char *name)
*/
struct ib_device *ib_alloc_device(size_t size)
{
void *dev;

BUG_ON(size < sizeof (struct ib_device));

dev = kmalloc(size, GFP_KERNEL);
if (!dev)
return NULL;

memset(dev, 0, size);

return dev;
return kzalloc(size, GFP_KERNEL);
}
EXPORT_SYMBOL(ib_alloc_device);

Expand Down
31 changes: 12 additions & 19 deletions drivers/infiniband/core/mad.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,11 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
}

/* Allocate structures */
mad_agent_priv = kmalloc(sizeof *mad_agent_priv, GFP_KERNEL);
mad_agent_priv = kzalloc(sizeof *mad_agent_priv, GFP_KERNEL);
if (!mad_agent_priv) {
ret = ERR_PTR(-ENOMEM);
goto error1;
}
memset(mad_agent_priv, 0, sizeof *mad_agent_priv);

mad_agent_priv->agent.mr = ib_get_dma_mr(port_priv->qp_info[qpn].qp->pd,
IB_ACCESS_LOCAL_WRITE);
Expand Down Expand Up @@ -448,14 +447,13 @@ struct ib_mad_agent *ib_register_mad_snoop(struct ib_device *device,
goto error1;
}
/* Allocate structures */
mad_snoop_priv = kmalloc(sizeof *mad_snoop_priv, GFP_KERNEL);
mad_snoop_priv = kzalloc(sizeof *mad_snoop_priv, GFP_KERNEL);
if (!mad_snoop_priv) {
ret = ERR_PTR(-ENOMEM);
goto error1;
}

/* Now, fill in the various structures */
memset(mad_snoop_priv, 0, sizeof *mad_snoop_priv);
mad_snoop_priv->qp_info = &port_priv->qp_info[qpn];
mad_snoop_priv->agent.device = device;
mad_snoop_priv->agent.recv_handler = recv_handler;
Expand Down Expand Up @@ -794,10 +792,9 @@ struct ib_mad_send_buf * ib_create_send_mad(struct ib_mad_agent *mad_agent,
(!rmpp_active && buf_size > sizeof(struct ib_mad)))
return ERR_PTR(-EINVAL);

buf = kmalloc(sizeof *mad_send_wr + buf_size, gfp_mask);
buf = kzalloc(sizeof *mad_send_wr + buf_size, gfp_mask);
if (!buf)
return ERR_PTR(-ENOMEM);
memset(buf, 0, sizeof *mad_send_wr + buf_size);

mad_send_wr = buf + buf_size;
mad_send_wr->send_buf.mad = buf;
Expand Down Expand Up @@ -1039,14 +1036,12 @@ static int method_in_use(struct ib_mad_mgmt_method_table **method,
static int allocate_method_table(struct ib_mad_mgmt_method_table **method)
{
/* Allocate management method table */
*method = kmalloc(sizeof **method, GFP_ATOMIC);
*method = kzalloc(sizeof **method, GFP_ATOMIC);
if (!*method) {
printk(KERN_ERR PFX "No memory for "
"ib_mad_mgmt_method_table\n");
return -ENOMEM;
}
/* Clear management method table */
memset(*method, 0, sizeof **method);

return 0;
}
Expand Down Expand Up @@ -1137,15 +1132,14 @@ static int add_nonoui_reg_req(struct ib_mad_reg_req *mad_reg_req,
class = &port_priv->version[mad_reg_req->mgmt_class_version].class;
if (!*class) {
/* Allocate management class table for "new" class version */
*class = kmalloc(sizeof **class, GFP_ATOMIC);
*class = kzalloc(sizeof **class, GFP_ATOMIC);
if (!*class) {
printk(KERN_ERR PFX "No memory for "
"ib_mad_mgmt_class_table\n");
ret = -ENOMEM;
goto error1;
}
/* Clear management class table */
memset(*class, 0, sizeof(**class));

/* Allocate method table for this management class */
method = &(*class)->method_table[mgmt_class];
if ((ret = allocate_method_table(method)))
Expand Down Expand Up @@ -1209,25 +1203,24 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req,
mad_reg_req->mgmt_class_version].vendor;
if (!*vendor_table) {
/* Allocate mgmt vendor class table for "new" class version */
vendor = kmalloc(sizeof *vendor, GFP_ATOMIC);
vendor = kzalloc(sizeof *vendor, GFP_ATOMIC);
if (!vendor) {
printk(KERN_ERR PFX "No memory for "
"ib_mad_mgmt_vendor_class_table\n");
goto error1;
}
/* Clear management vendor class table */
memset(vendor, 0, sizeof(*vendor));

*vendor_table = vendor;
}
if (!(*vendor_table)->vendor_class[vclass]) {
/* Allocate table for this management vendor class */
vendor_class = kmalloc(sizeof *vendor_class, GFP_ATOMIC);
vendor_class = kzalloc(sizeof *vendor_class, GFP_ATOMIC);
if (!vendor_class) {
printk(KERN_ERR PFX "No memory for "
"ib_mad_mgmt_vendor_class\n");
goto error2;
}
memset(vendor_class, 0, sizeof(*vendor_class));

(*vendor_table)->vendor_class[vclass] = vendor_class;
}
for (i = 0; i < MAX_MGMT_OUI; i++) {
Expand Down Expand Up @@ -2524,12 +2517,12 @@ static int ib_mad_port_open(struct ib_device *device,
char name[sizeof "ib_mad123"];

/* Create new device info */
port_priv = kmalloc(sizeof *port_priv, GFP_KERNEL);
port_priv = kzalloc(sizeof *port_priv, GFP_KERNEL);
if (!port_priv) {
printk(KERN_ERR PFX "No memory for ib_mad_port_private\n");
return -ENOMEM;
}
memset(port_priv, 0, sizeof *port_priv);

port_priv->device = device;
port_priv->port_num = port_num;
spin_lock_init(&port_priv->reg_lock);
Expand Down
6 changes: 2 additions & 4 deletions drivers/infiniband/core/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,14 +307,13 @@ static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr,
if (!p->ibdev->process_mad)
return sprintf(buf, "N/A (no PMA)\n");

in_mad = kmalloc(sizeof *in_mad, GFP_KERNEL);
in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
out_mad = kmalloc(sizeof *in_mad, GFP_KERNEL);
if (!in_mad || !out_mad) {
ret = -ENOMEM;
goto out;
}

memset(in_mad, 0, sizeof *in_mad);
in_mad->mad_hdr.base_version = 1;
in_mad->mad_hdr.mgmt_class = IB_MGMT_CLASS_PERF_MGMT;
in_mad->mad_hdr.class_version = 1;
Expand Down Expand Up @@ -508,10 +507,9 @@ static int add_port(struct ib_device *device, int port_num)
if (ret)
return ret;

p = kmalloc(sizeof *p, GFP_KERNEL);
p = kzalloc(sizeof *p, GFP_KERNEL);
if (!p)
return -ENOMEM;
memset(p, 0, sizeof *p);

p->ibdev = device;
p->port_num = port_num;
Expand Down
9 changes: 3 additions & 6 deletions drivers/infiniband/core/ucm.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,10 @@ static struct ib_ucm_context *ib_ucm_ctx_alloc(struct ib_ucm_file *file)
struct ib_ucm_context *ctx;
int result;

ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
ctx = kzalloc(sizeof *ctx, GFP_KERNEL);
if (!ctx)
return NULL;

memset(ctx, 0, sizeof *ctx);
atomic_set(&ctx->ref, 1);
init_waitqueue_head(&ctx->wait);
ctx->file = file;
Expand Down Expand Up @@ -386,11 +385,10 @@ static int ib_ucm_event_handler(struct ib_cm_id *cm_id,

ctx = cm_id->context;

uevent = kmalloc(sizeof(*uevent), GFP_KERNEL);
uevent = kzalloc(sizeof *uevent, GFP_KERNEL);
if (!uevent)
goto err1;

memset(uevent, 0, sizeof(*uevent));
uevent->ctx = ctx;
uevent->cm_id = cm_id;
uevent->resp.uid = ctx->uid;
Expand Down Expand Up @@ -1345,11 +1343,10 @@ static void ib_ucm_add_one(struct ib_device *device)
if (!device->alloc_ucontext)
return;

ucm_dev = kmalloc(sizeof *ucm_dev, GFP_KERNEL);
ucm_dev = kzalloc(sizeof *ucm_dev, GFP_KERNEL);
if (!ucm_dev)
return;

memset(ucm_dev, 0, sizeof *ucm_dev);
ucm_dev->ib_dev = device;

ucm_dev->devnum = find_first_zero_bit(dev_map, IB_UCM_MAX_DEVICES);
Expand Down
Loading

0 comments on commit ba77df5

Please sign in to comment.