err("%s: Couldn't get results [%d]", serial->type->name, ret); 
err("%s: Couldn't get results [%d]", serial->type->description, ret); 
static int whiteheat_attach (struct usb_serial *serial){	struct usb_serial_port *command_port;	struct whiteheat_command_private *command_info;	struct usb_serial_port *port;	struct whiteheat_private *info;	struct whiteheat_hw_info *hw_info;	int pipe;	int ret;	int alen;	__u8 *command;	__u8 *result;	int i;	int j;	struct urb *urb;	int buf_size;	struct whiteheat_urb_wrap *wrap;	struct list_head *tmp;	command_port = serial->port[COMMAND_PORT];	pipe = usb_sndbulkpipe (serial->dev, command_port->bulk_out_endpointAddress);	command = kmalloc(2, GFP_KERNEL);	if (!command)		goto no_command_buffer;	command[0] = WHITEHEAT_GET_HW_INFO;	command[1] = 0;		result = kmalloc(sizeof(*hw_info) + 1, GFP_KERNEL);	if (!result)		goto no_result_buffer;	/*	 * When the module is reloaded the firmware is still there and	 * the endpoints are still in the usb core unchanged. This is the         * unlinking bug in disguise. Same for the call below.         */	usb_clear_halt(serial->dev, pipe);	ret = usb_bulk_msg (serial->dev, pipe, command, 2, &alen, COMMAND_TIMEOUT_MS);	if (ret) {		err("%s: Couldn't send command [%d]", serial->type->name, ret);		goto no_firmware;	} else if (alen != sizeof(command)) {		err("%s: Send command incomplete [%d]", serial->type->name, alen);		goto no_firmware;	}	pipe = usb_rcvbulkpipe (serial->dev, command_port->bulk_in_endpointAddress);	/* See the comment on the usb_clear_halt() above */	usb_clear_halt(serial->dev, pipe);	ret = usb_bulk_msg (serial->dev, pipe, result, sizeof(*hw_info) + 1, &alen, COMMAND_TIMEOUT_MS);	if (ret) {		err("%s: Couldn't get results [%d]", serial->type->name, ret);		goto no_firmware;	} else if (alen != sizeof(result)) {		err("%s: Get results incomplete [%d]", serial->type->name, alen);		goto no_firmware;	} else if (result[0] != command[0]) {		err("%s: Command failed [%d]", serial->type->name, result[0]);		goto no_firmware;	}	hw_info = (struct whiteheat_hw_info *)&result[1];	info("%s: Driver %s: Firmware v%d.%02d", serial->type->name,	     DRIVER_VERSION, hw_info->sw_major_rev, hw_info->sw_minor_rev);	for (i = 0; i < serial->num_ports; i++) {		port = serial->port[i];		info = (struct whiteheat_private *)kmalloc(sizeof(struct whiteheat_private), GFP_KERNEL);		if (info == NULL) {			err("%s: Out of memory for port structures\n", serial->type->name);			goto no_private;		}		spin_lock_init(&info->lock);		info->flags = 0;		info->mcr = 0;		INIT_WORK(&info->rx_work, rx_data_softint, port);		INIT_LIST_HEAD(&info->rx_urbs_free);		INIT_LIST_HEAD(&info->rx_urbs_submitted);		INIT_LIST_HEAD(&info->rx_urb_q);		INIT_LIST_HEAD(&info->tx_urbs_free);		INIT_LIST_HEAD(&info->tx_urbs_submitted);		for (j = 0; j < urb_pool_size; j++) {			urb = usb_alloc_urb(0, GFP_KERNEL);			if (!urb) {				err("No free urbs available");				goto no_rx_urb;			}			buf_size = port->read_urb->transfer_buffer_length;			urb->transfer_buffer = kmalloc(buf_size, GFP_KERNEL);			if (!urb->transfer_buffer) {				err("Couldn't allocate urb buffer");				goto no_rx_buf;			}			wrap = kmalloc(sizeof(*wrap), GFP_KERNEL);			if (!wrap) {				err("Couldn't allocate urb wrapper");				goto no_rx_wrap;			}			usb_fill_bulk_urb(urb, serial->dev,					usb_rcvbulkpipe(serial->dev,						port->bulk_in_endpointAddress),					urb->transfer_buffer, buf_size,					whiteheat_read_callback, port);			wrap->urb = urb;			list_add(&wrap->list, &info->rx_urbs_free);			urb = usb_alloc_urb(0, GFP_KERNEL);			if (!urb) {				err("No free urbs available");				goto no_tx_urb;			}			buf_size = port->write_urb->transfer_buffer_length;			urb->transfer_buffer = kmalloc(buf_size, GFP_KERNEL);			if (!urb->transfer_buffer) {				err("Couldn't allocate urb buffer");				goto no_tx_buf;			}			wrap = kmalloc(sizeof(*wrap), GFP_KERNEL);			if (!wrap) {				err("Couldn't allocate urb wrapper");				goto no_tx_wrap;			}			usb_fill_bulk_urb(urb, serial->dev,					usb_sndbulkpipe(serial->dev,						port->bulk_out_endpointAddress),					urb->transfer_buffer, buf_size,					whiteheat_write_callback, port);			wrap->urb = urb;			list_add(&wrap->list, &info->tx_urbs_free);		}		usb_set_serial_port_data(port, info);	}	command_info = (struct whiteheat_command_private *)kmalloc(sizeof(struct whiteheat_command_private), GFP_KERNEL);	if (command_info == NULL) {		err("%s: Out of memory for port structures\n", serial->type->name);		goto no_command_private;	}	spin_lock_init(&command_info->lock);	command_info->port_running = 0;	init_waitqueue_head(&command_info->wait_command);	usb_set_serial_port_data(command_port, command_info);	command_port->write_urb->complete = command_port_write_callback;	command_port->read_urb->complete = command_port_read_callback;	kfree(result);	kfree(command);	return 0;no_firmware:	/* Firmware likely not running */	err("%s: Unable to retrieve firmware version, try replugging\n", serial->type->name);	err("%s: If the firmware is not running (status led not blinking)\n", serial->type->name);	err("%s: please contact support@connecttech.com\n", serial->type->name);	return -ENODEV;no_command_private:	for (i = serial->num_ports - 1; i >= 0; i--) {		port = serial->port[i];		info = usb_get_serial_port_data(port);		for (j = urb_pool_size - 1; j >= 0; j--) {			tmp = list_first(&info->tx_urbs_free);			list_del(tmp);			wrap = list_entry(tmp, struct whiteheat_urb_wrap, list);			urb = wrap->urb;			kfree(wrap);no_tx_wrap:			kfree(urb->transfer_buffer);no_tx_buf:			usb_free_urb(urb);no_tx_urb:			tmp = list_first(&info->rx_urbs_free);			list_del(tmp);			wrap = list_entry(tmp, struct whiteheat_urb_wrap, list);			urb = wrap->urb;			kfree(wrap);no_rx_wrap:			kfree(urb->transfer_buffer);no_rx_buf:			usb_free_urb(urb);no_rx_urb:			;		}		kfree(info);no_private:		;	}	kfree(result);no_result_buffer:	kfree(command);no_command_buffer:	return -ENOMEM;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/269bda1c123c7caf88e1deb2264f9086f0344192/whiteheat.c/buggy/drivers/usb/serial/whiteheat.c