if (!(a3d = kcalloc(1, sizeof(struct a3d), GFP_KERNEL))) 
if (!(a3d = kzalloc(sizeof(struct a3d), GFP_KERNEL))) 
static int a3d_connect(struct gameport *gameport, struct gameport_driver *drv){	struct a3d *a3d;	struct gameport *adc;	unsigned char data[A3D_MAX_LENGTH];	int i;	int err;	if (!(a3d = kcalloc(1, sizeof(struct a3d), GFP_KERNEL)))		return -ENOMEM;	a3d->gameport = gameport;	gameport_set_drvdata(gameport, a3d);	err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW);	if (err)		goto fail1;	i = a3d_read_packet(gameport, A3D_MAX_LENGTH, data);	if (!i || a3d_csum(data, i)) {		err = -ENODEV;		goto fail2;	}	a3d->mode = data[0];	if (!a3d->mode || a3d->mode > 5) {		printk(KERN_WARNING "a3d.c: Unknown A3D device detected "			"(%s, id=%d), contact <vojtech@ucw.cz>\n", gameport->phys, a3d->mode);		err = -ENODEV;		goto fail2;	}	gameport_set_poll_handler(gameport, a3d_poll);	gameport_set_poll_interval(gameport, 20);	sprintf(a3d->phys, "%s/input0", gameport->phys);	if (a3d->mode == A3D_MODE_PXL) {		int axes[] = { ABS_X, ABS_Y, ABS_THROTTLE, ABS_RUDDER };		a3d->length = 33;		init_input_dev(&a3d->dev);		a3d->dev.evbit[0] |= BIT(EV_ABS) | BIT(EV_KEY) | BIT(EV_REL);		a3d->dev.relbit[0] |= BIT(REL_X) | BIT(REL_Y);		a3d->dev.absbit[0] |= BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_THROTTLE) | BIT(ABS_RUDDER)				   | BIT(ABS_HAT0X) | BIT(ABS_HAT0Y) | BIT(ABS_HAT1X) | BIT(ABS_HAT1Y);		a3d->dev.keybit[LONG(BTN_MOUSE)] |= BIT(BTN_RIGHT) | BIT(BTN_LEFT) | BIT(BTN_MIDDLE)						 | BIT(BTN_SIDE) | BIT(BTN_EXTRA);		a3d->dev.keybit[LONG(BTN_JOYSTICK)] |= BIT(BTN_TRIGGER) | BIT(BTN_THUMB) | BIT(BTN_TOP) | BIT(BTN_PINKIE);		a3d_read(a3d, data);		for (i = 0; i < 4; i++) {			if (i < 2)				input_set_abs_params(&a3d->dev, axes[i], 48, a3d->dev.abs[axes[i]] * 2 - 48, 0, 8);			else				input_set_abs_params(&a3d->dev, axes[i], 2, 253, 0, 0);			input_set_abs_params(&a3d->dev, ABS_HAT0X + i, -1, 1, 0, 0);		}	} else {		a3d->length = 29;		init_input_dev(&a3d->dev);		a3d->dev.evbit[0] |= BIT(EV_KEY) | BIT(EV_REL);		a3d->dev.relbit[0] |= BIT(REL_X) | BIT(REL_Y);		a3d->dev.keybit[LONG(BTN_MOUSE)] |= BIT(BTN_RIGHT) | BIT(BTN_LEFT) | BIT(BTN_MIDDLE);		a3d_read(a3d, data);		if (!(a3d->adc = adc = gameport_allocate_port()))			printk(KERN_ERR "a3d: Not enough memory for ADC port\n");		else {			adc->port_data = a3d;			adc->open = a3d_adc_open;			adc->close = a3d_adc_close;			adc->cooked_read = a3d_adc_cooked_read;			adc->fuzz = 1;			gameport_set_name(adc, a3d_names[a3d->mode]);			gameport_set_phys(adc, "%s/gameport0", gameport->phys);			adc->dev.parent = &gameport->dev;			gameport_register_port(adc);		}	}	a3d->dev.private = a3d;	a3d->dev.open = a3d_open;	a3d->dev.close = a3d_close;	a3d->dev.name = a3d_names[a3d->mode];	a3d->dev.phys = a3d->phys;	a3d->dev.id.bustype = BUS_GAMEPORT;	a3d->dev.id.vendor = GAMEPORT_ID_VENDOR_MADCATZ;	a3d->dev.id.product = a3d->mode;	a3d->dev.id.version = 0x0100;	input_register_device(&a3d->dev);	printk(KERN_INFO "input: %s on %s\n", a3d_names[a3d->mode], a3d->phys);	return 0;fail2:	gameport_close(gameport);fail1:  gameport_set_drvdata(gameport, NULL);	kfree(a3d);	return err;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/a97e148a8b8da8b04bc3e18ceb824a8f5f56d567/a3d.c/buggy/drivers/input/joystick/a3d.c