Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba77df57 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband

parents 602d4a7e d09e3276
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -155,13 +155,12 @@ int ib_agent_port_open(struct ib_device *device, int port_num)
	int ret;
	int ret;


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


	/* Obtain send only MAD agent for SMI QP */
	/* Obtain send only MAD agent for SMI QP */
	port_priv->agent[0] = ib_register_mad_agent(device, port_num,
	port_priv->agent[0] = ib_register_mad_agent(device, port_num,
+2 −4
Original line number Original line Diff line number Diff line
@@ -544,11 +544,10 @@ struct ib_cm_id *ib_create_cm_id(struct ib_device *device,
	struct cm_id_private *cm_id_priv;
	struct cm_id_private *cm_id_priv;
	int ret;
	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)
	if (!cm_id_priv)
		return ERR_PTR(-ENOMEM);
		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.state = IB_CM_IDLE;
	cm_id_priv->id.device = device;
	cm_id_priv->id.device = device;
	cm_id_priv->id.cm_handler = cm_handler;
	cm_id_priv->id.cm_handler = cm_handler;
@@ -621,10 +620,9 @@ static struct cm_timewait_info * cm_create_timewait_info(__be32 local_id)
{
{
	struct cm_timewait_info *timewait_info;
	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)
	if (!timewait_info)
		return ERR_PTR(-ENOMEM);
		return ERR_PTR(-ENOMEM);
	memset(timewait_info, 0, sizeof *timewait_info);


	timewait_info->work.local_id = local_id;
	timewait_info->work.local_id = local_id;
	INIT_WORK(&timewait_info->work.work, cm_work_handler,
	INIT_WORK(&timewait_info->work.work, cm_work_handler,
+1 −9
Original line number Original line Diff line number Diff line
@@ -161,17 +161,9 @@ static int alloc_name(char *name)
 */
 */
struct ib_device *ib_alloc_device(size_t size)
struct ib_device *ib_alloc_device(size_t size)
{
{
	void *dev;

	BUG_ON(size < sizeof (struct ib_device));
	BUG_ON(size < sizeof (struct ib_device));


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

	memset(dev, 0, size);

	return dev;
}
}
EXPORT_SYMBOL(ib_alloc_device);
EXPORT_SYMBOL(ib_alloc_device);


+12 −19
Original line number Original line Diff line number Diff line
@@ -255,12 +255,11 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
	}
	}


	/* Allocate structures */
	/* 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) {
	if (!mad_agent_priv) {
		ret = ERR_PTR(-ENOMEM);
		ret = ERR_PTR(-ENOMEM);
		goto error1;
		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,
	mad_agent_priv->agent.mr = ib_get_dma_mr(port_priv->qp_info[qpn].qp->pd,
						 IB_ACCESS_LOCAL_WRITE);
						 IB_ACCESS_LOCAL_WRITE);
@@ -448,14 +447,13 @@ struct ib_mad_agent *ib_register_mad_snoop(struct ib_device *device,
		goto error1;
		goto error1;
	}
	}
	/* Allocate structures */
	/* 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) {
	if (!mad_snoop_priv) {
		ret = ERR_PTR(-ENOMEM);
		ret = ERR_PTR(-ENOMEM);
		goto error1;
		goto error1;
	}
	}


	/* Now, fill in the various structures */
	/* 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->qp_info = &port_priv->qp_info[qpn];
	mad_snoop_priv->agent.device = device;
	mad_snoop_priv->agent.device = device;
	mad_snoop_priv->agent.recv_handler = recv_handler;
	mad_snoop_priv->agent.recv_handler = recv_handler;
@@ -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)))
	    (!rmpp_active && buf_size > sizeof(struct ib_mad)))
		return ERR_PTR(-EINVAL);
		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)
	if (!buf)
		return ERR_PTR(-ENOMEM);
		return ERR_PTR(-ENOMEM);
	memset(buf, 0, sizeof *mad_send_wr + buf_size);


	mad_send_wr = buf + buf_size;
	mad_send_wr = buf + buf_size;
	mad_send_wr->send_buf.mad = buf;
	mad_send_wr->send_buf.mad = buf;
@@ -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)
static int allocate_method_table(struct ib_mad_mgmt_method_table **method)
{
{
	/* Allocate management method table */
	/* Allocate management method table */
	*method = kmalloc(sizeof **method, GFP_ATOMIC);
	*method = kzalloc(sizeof **method, GFP_ATOMIC);
	if (!*method) {
	if (!*method) {
		printk(KERN_ERR PFX "No memory for "
		printk(KERN_ERR PFX "No memory for "
		       "ib_mad_mgmt_method_table\n");
		       "ib_mad_mgmt_method_table\n");
		return -ENOMEM;
		return -ENOMEM;
	}
	}
	/* Clear management method table */
	memset(*method, 0, sizeof **method);


	return 0;
	return 0;
}
}
@@ -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;
	class = &port_priv->version[mad_reg_req->mgmt_class_version].class;
	if (!*class) {
	if (!*class) {
		/* Allocate management class table for "new" class version */
		/* Allocate management class table for "new" class version */
		*class = kmalloc(sizeof **class, GFP_ATOMIC);
		*class = kzalloc(sizeof **class, GFP_ATOMIC);
		if (!*class) {
		if (!*class) {
			printk(KERN_ERR PFX "No memory for "
			printk(KERN_ERR PFX "No memory for "
			       "ib_mad_mgmt_class_table\n");
			       "ib_mad_mgmt_class_table\n");
			ret = -ENOMEM;
			ret = -ENOMEM;
			goto error1;
			goto error1;
		}
		}
		/* Clear management class table */

		memset(*class, 0, sizeof(**class));
		/* Allocate method table for this management class */
		/* Allocate method table for this management class */
		method = &(*class)->method_table[mgmt_class];
		method = &(*class)->method_table[mgmt_class];
		if ((ret = allocate_method_table(method)))
		if ((ret = allocate_method_table(method)))
@@ -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;
				mad_reg_req->mgmt_class_version].vendor;
	if (!*vendor_table) {
	if (!*vendor_table) {
		/* Allocate mgmt vendor class table for "new" class version */
		/* Allocate mgmt vendor class table for "new" class version */
		vendor = kmalloc(sizeof *vendor, GFP_ATOMIC);
		vendor = kzalloc(sizeof *vendor, GFP_ATOMIC);
		if (!vendor) {
		if (!vendor) {
			printk(KERN_ERR PFX "No memory for "
			printk(KERN_ERR PFX "No memory for "
			       "ib_mad_mgmt_vendor_class_table\n");
			       "ib_mad_mgmt_vendor_class_table\n");
			goto error1;
			goto error1;
		}
		}
		/* Clear management vendor class table */

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

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


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

	port_priv->device = device;
	port_priv->device = device;
	port_priv->port_num = port_num;
	port_priv->port_num = port_num;
	spin_lock_init(&port_priv->reg_lock);
	spin_lock_init(&port_priv->reg_lock);
+2 −4
Original line number Original line Diff line number Diff line
@@ -307,14 +307,13 @@ static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr,
	if (!p->ibdev->process_mad)
	if (!p->ibdev->process_mad)
		return sprintf(buf, "N/A (no PMA)\n");
		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);
	out_mad = kmalloc(sizeof *in_mad, GFP_KERNEL);
	if (!in_mad || !out_mad) {
	if (!in_mad || !out_mad) {
		ret = -ENOMEM;
		ret = -ENOMEM;
		goto out;
		goto out;
	}
	}


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


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


	p->ibdev      = device;
	p->ibdev      = device;
	p->port_num   = port_num;
	p->port_num   = port_num;
Loading