ib_unregister_mad_agent(port_priv->smp_agent); 
ib_unregister_mad_agent(port_priv->agent[0]); 
int ib_agent_port_open(struct ib_device *device, int port_num){	int ret;	struct ib_agent_port_private *port_priv;	unsigned long flags;	/* First, check if port already open for SMI */	port_priv = ib_get_agent_port(device, port_num, NULL);	if (port_priv) {		printk(KERN_DEBUG SPFX "%s port %d already open\n",		       device->name, port_num);		return 0;	}	/* Create new device info */	port_priv = kmalloc(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);	port_priv->port_num = port_num;	spin_lock_init(&port_priv->send_list_lock);	INIT_LIST_HEAD(&port_priv->send_posted_list);	/* Obtain send only MAD agent for SM class (SMI QP) */	port_priv->smp_agent = ib_register_mad_agent(device, port_num,						     IB_QPT_SMI,						     NULL, 0,						    &agent_send_handler,						     NULL, NULL);	if (IS_ERR(port_priv->smp_agent)) {		ret = PTR_ERR(port_priv->smp_agent);		goto error2;	}	/* Obtain send only MAD agent for PerfMgmt class (GSI QP) */	port_priv->perf_mgmt_agent = ib_register_mad_agent(device, port_num,							   IB_QPT_GSI,							   NULL, 0,							  &agent_send_handler,							   NULL, NULL);	if (IS_ERR(port_priv->perf_mgmt_agent)) {		ret = PTR_ERR(port_priv->perf_mgmt_agent);		goto error3;	}	spin_lock_irqsave(&ib_agent_port_list_lock, flags);	list_add_tail(&port_priv->port_list, &ib_agent_port_list);	spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);	return 0;error3:	ib_unregister_mad_agent(port_priv->smp_agent);error2:	kfree(port_priv);error1:	return ret;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/34816ad98efe4d47ffd858a0345321f9d85d9420/agent.c/clean/drivers/infiniband/core/agent.c