 err_free_devs: while (--i >= 0) input_unregister_device(tgfx->dev[i]); err_free_tgfx: kfree(tgfx); err_unreg_pardev: parport_unregister_device(pd); err_put_pp: parport_put_port(pp); err_out: return ERR_PTR(err); 
static struct tgfx __init *tgfx_probe(int *config, int nargs){	struct tgfx *tgfx;	struct parport *pp;	int i, j;	if (config[0] < 0)		return NULL;	if (nargs < 2) {		printk(KERN_ERR "turbografx.c: at least one joystick must be specified\n");		return NULL;	}	pp = parport_find_number(config[0]);	if (!pp) {		printk(KERN_ERR "turbografx.c: no such parport\n");		return NULL;	}	if (!(tgfx = kzalloc(sizeof(struct tgfx), GFP_KERNEL))) {		parport_put_port(pp);		return NULL;	}	init_MUTEX(&tgfx->sem);	tgfx->pd = parport_register_device(pp, "turbografx", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);	parport_put_port(pp);	if (!tgfx->pd) {		printk(KERN_ERR "turbografx.c: parport busy already - lp.o loaded?\n");		kfree(tgfx);		return NULL;	}	init_timer(&tgfx->timer);	tgfx->timer.data = (long) tgfx;	tgfx->timer.function = tgfx_timer;	tgfx->sticks = 0;	for (i = 0; i < nargs - 1; i++)		if (config[i+1] > 0 && config[i+1] < 6) {			tgfx->sticks |= (1 << i);			tgfx->dev[i].private = tgfx;			tgfx->dev[i].open = tgfx_open;			tgfx->dev[i].close = tgfx_close;			sprintf(tgfx->phys[i], "%s/input0", tgfx->pd->port->name);			tgfx->dev[i].name = tgfx_name;			tgfx->dev[i].phys = tgfx->phys[i];			tgfx->dev[i].id.bustype = BUS_PARPORT;			tgfx->dev[i].id.vendor = 0x0003;			tgfx->dev[i].id.product = config[i+1];			tgfx->dev[i].id.version = 0x0100;			tgfx->dev[i].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);			tgfx->dev[i].absbit[0] = BIT(ABS_X) | BIT(ABS_Y);			for (j = 0; j < config[i+1]; j++)				set_bit(tgfx_buttons[j], tgfx->dev[i].keybit);			tgfx->dev[i].absmin[ABS_X] = -1; tgfx->dev[i].absmax[ABS_X] = 1;			tgfx->dev[i].absmin[ABS_Y] = -1; tgfx->dev[i].absmax[ABS_Y] = 1;			input_register_device(tgfx->dev + i);			printk(KERN_INFO "input: %d-button Multisystem joystick on %s\n",				config[i+1], tgfx->pd->port->name);		}        if (!tgfx->sticks) {		parport_unregister_device(tgfx->pd);		kfree(tgfx);		return NULL;        }	return tgfx;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/17dd3f0f7aa729a042af5d3318ff9b3e7781b45b/turbografx.c/buggy/drivers/input/joystick/turbografx.c