kref_put(&user->refcount, free_user); 
static int handle_ipmb_get_msg_cmd(ipmi_smi_t          intf,				   struct ipmi_smi_msg *msg){	struct cmd_rcvr       *rcvr;	int                   rv = 0;	unsigned char         netfn;	unsigned char         cmd;	ipmi_user_t           user = NULL;	struct ipmi_ipmb_addr *ipmb_addr;	struct ipmi_recv_msg  *recv_msg;	unsigned long         flags;	if (msg->rsp_size < 10) {		/* Message not big enough, just ignore it. */		spin_lock_irqsave(&intf->counter_lock, flags);		intf->invalid_commands++;		spin_unlock_irqrestore(&intf->counter_lock, flags);		return 0;	}	if (msg->rsp[2] != 0) {		/* An error getting the response, just ignore it. */		return 0;	}	netfn = msg->rsp[4] >> 2;	cmd = msg->rsp[8];	read_lock(&(intf->cmd_rcvr_lock));		/* Find the command/netfn. */	list_for_each_entry(rcvr, &(intf->cmd_rcvrs), link) {		if ((rcvr->netfn == netfn) && (rcvr->cmd == cmd)) {			user = rcvr->user;			break;		}	}	read_unlock(&(intf->cmd_rcvr_lock));	if (user == NULL) {		/* We didn't find a user, deliver an error response. */		spin_lock_irqsave(&intf->counter_lock, flags);		intf->unhandled_commands++;		spin_unlock_irqrestore(&intf->counter_lock, flags);		msg->data[0] = (IPMI_NETFN_APP_REQUEST << 2);		msg->data[1] = IPMI_SEND_MSG_CMD;		msg->data[2] = msg->rsp[3];		msg->data[3] = msg->rsp[6];                msg->data[4] = ((netfn + 1) << 2) | (msg->rsp[7] & 0x3);		msg->data[5] = ipmb_checksum(&(msg->data[3]), 2);		msg->data[6] = intf->channels[msg->rsp[3] & 0xf].address;                /* rqseq/lun */                msg->data[7] = (msg->rsp[7] & 0xfc) | (msg->rsp[4] & 0x3);		msg->data[8] = msg->rsp[8]; /* cmd */		msg->data[9] = IPMI_INVALID_CMD_COMPLETION_CODE;		msg->data[10] = ipmb_checksum(&(msg->data[6]), 4);		msg->data_size = 11;#ifdef DEBUG_MSGING	{		int m;		printk("Invalid command:");		for (m = 0; m < msg->data_size; m++)			printk(" %2.2x", msg->data[m]);		printk("\n");	}#endif		intf->handlers->sender(intf->send_info, msg, 0);		rv = -1; /* We used the message, so return the value that			    causes it to not be freed or queued. */	} else {		/* Deliver the message to the user. */		spin_lock_irqsave(&intf->counter_lock, flags);		intf->handled_commands++;		spin_unlock_irqrestore(&intf->counter_lock, flags);		recv_msg = ipmi_alloc_recv_msg();		if (! recv_msg) {			/* We couldn't allocate memory for the                           message, so requeue it for handling                           later. */			rv = 1;		} else {			/* Extract the source address from the data. */			ipmb_addr = (struct ipmi_ipmb_addr *) &recv_msg->addr;			ipmb_addr->addr_type = IPMI_IPMB_ADDR_TYPE;			ipmb_addr->slave_addr = msg->rsp[6];			ipmb_addr->lun = msg->rsp[7] & 3;			ipmb_addr->channel = msg->rsp[3] & 0xf;			/* Extract the rest of the message information			   from the IPMB header.*/			recv_msg->user = user;			recv_msg->recv_type = IPMI_CMD_RECV_TYPE;			recv_msg->msgid = msg->rsp[7] >> 2;			recv_msg->msg.netfn = msg->rsp[4] >> 2;			recv_msg->msg.cmd = msg->rsp[8];			recv_msg->msg.data = recv_msg->msg_data;			/* We chop off 10, not 9 bytes because the checksum			   at the end also needs to be removed. */			recv_msg->msg.data_len = msg->rsp_size - 10;			memcpy(recv_msg->msg_data,			       &(msg->rsp[9]),			       msg->rsp_size - 10);			deliver_response(recv_msg);		}	}	return rv;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/393d2cc354d150b8b4bb888a9da7db4c935e12bd/ipmi_msghandler.c/clean/drivers/char/ipmi/ipmi_msghandler.c