 fail2:	for (i = 0; i < 2; i++) if (port->adi[i].dev) input_free_device(port->adi[i].dev); gameport_close(gameport); fail1:	gameport_set_drvdata(gameport, NULL); kfree(port); return err; 
static int adi_connect(struct gameport *gameport, struct gameport_driver *drv){	struct adi_port *port;	int i;	int err;	if (!(port = kzalloc(sizeof(struct adi_port), GFP_KERNEL)))		return -ENOMEM;	port->gameport = gameport;	gameport_set_drvdata(gameport, port);	err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW);	if (err) {		kfree(port);		return err;	}	adi_init_digital(gameport);	adi_read_packet(port);	if (port->adi[0].ret >= ADI_MIN_LEN_LENGTH)		adi_move_bits(port, adi_get_bits(port->adi, 10));	for (i = 0; i < 2; i++) {		adi_id_decode(port->adi + i, port);		adi_init_input(port->adi + i, port, i);	}	if (!port->adi[0].length && !port->adi[1].length) {		gameport_close(gameport);		kfree(port);		return -ENODEV;	}	gameport_set_poll_handler(gameport, adi_poll);	gameport_set_poll_interval(gameport, 20);	msleep(ADI_INIT_DELAY);	if (adi_read(port)) {		msleep(ADI_DATA_DELAY);		adi_read(port);	}	for (i = 0; i < 2; i++)		if (port->adi[i].length > 0) {			adi_init_center(port->adi + i);			input_register_device(&port->adi[i].dev);			printk(KERN_INFO "input: %s [%s] on %s\n",				port->adi[i].name, port->adi[i].cname, gameport->phys);		}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/17dd3f0f7aa729a042af5d3318ff9b3e7781b45b/adi.c/clean/drivers/input/joystick/adi.c