Re: [PATCH] Add support for HTC Shift Touchscreen

From: Marcin Slusarz
Date: Sun May 18 2008 - 05:28:00 EST


On Sat, May 17, 2008 at 06:38:20PM +0200, Pau Oliva Fora wrote:
> +static int __init htcpen_init(void)
> +{
> + int err;
> +
> + printk(KERN_INFO "htcpen: module inserted\n");
> +
> + inb_p(HTCPEN_PORT_IRQ_CLEAR);
> +
> + htcpen_dev = input_allocate_device();
> + if (!htcpen_dev) {
> + printk(KERN_ERR "htcpen: can't allocate device\n");
> + err = -ENOMEM;
> + goto fail1;

htcpen_dev is null here, so no need to call input_free_device

> + }
> +
> + htcpen_dev->name = "HTC Pen TouchScreen";
> + htcpen_dev->id.bustype = BUS_ISA;
> + htcpen_dev->id.vendor = 0;
> + htcpen_dev->id.product = 0;
> + htcpen_dev->id.version = 0;
> +
> + input_set_abs_params(htcpen_dev, ABS_X, 0, X_AXIS_MAX, 0, 0);
> + input_set_abs_params(htcpen_dev, ABS_Y, 0, Y_AXIS_MAX, 0, 0);
> +
> + htcpen_dev->evbit[0] = BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY);
> + htcpen_dev->absbit[0] = BIT_MASK(ABS_X) | BIT_MASK(ABS_Y);
> + htcpen_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
> +
> + err = request_irq(HTCPEN_IRQ, htcpen_interrupt, 0, "htcpen",
> + htcpen_dev);
> + if (err) {
> + printk(KERN_ERR "htcpen: irq busy\n");
> + err = -EBUSY;
> + goto fail1;
> + }
> +
> + err = input_register_device(htcpen_dev);
> + if (err)
> + goto fail2;
> +
> + outb_p(DEVICE_ENABLE, HTCPEN_PORT_INIT);
> +
> + return 0;
> +
> + fail2: free_irq(HTCPEN_IRQ, htcpen_dev);
> + fail1: input_free_device(htcpen_dev);
> + return err;
> +}
> +
> +static void __exit htcpen_exit(void)
> +{
> + input_unregister_device(htcpen_dev);
> + free_irq(HTCPEN_IRQ, htcpen_dev);

input_free_device ?

> + printk(KERN_INFO "htcpen: module removed\n");
> +}

Marcin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/