From: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
To: Harald Welte <laforge@openmoko.org>
Cc: linux-arm-kernel@lists.arm.linux.org.uk, linux-input@vger.kernel.org
Subject: Re: [PATCH 8/12] neo1973: button input device driver
Date: Thu, 3 Jan 2008 12:05:02 -0500 [thread overview]
Message-ID: <d120d5000801030905h88b0edfy67c2f3fd562e3088@mail.gmail.com> (raw)
In-Reply-To: <20071218110807.GO29882@prithivi.gnumonks.org>
Hi Harald,
Sorry for the slow response.
On Dec 18, 2007 6:08 AM, Harald Welte <laforge@openmoko.org> wrote:
> +
> + input_dev->name = "Neo1973 Buttons";
> + input_dev->phys = "neo1973kbd/input0";
> + input_dev->id.bustype = BUS_HOST;
> + input_dev->id.vendor = 0x0001;
> + input_dev->id.product = 0x0001;
> + input_dev->id.version = 0x0100;
> + input_dev->cdev.dev = &pdev->dev;
Please use input_dev->dev.parent instead of cdev as it is going away.
> + input_dev->private = neo1973kbd;
Please use input_set_drvdata() instead of accessing private directly.
> +out_aux:
> + input_unregister_device(neo1973kbd->input);
Add neo1973kbd->input = NULL here, otherwise we'll end up doing
input_free_device after input_unregister_device which is no good
(unregister will free the device if it is the last reference).
> +out_register:
> + input_free_device(neo1973kbd->input);
> + platform_set_drvdata(pdev, NULL);
> + kfree(neo1973kbd);
> +
> + return -ENODEV;
> +}
> +
> +static int neo1973kbd_remove(struct platform_device *pdev)
> +{
> + struct neo1973kbd *neo1973kbd = platform_get_drvdata(pdev);
> +
> + free_irq(s3c2410_gpio_getirq(pdev->resource[2].start), neo1973kbd);
> + free_irq(s3c2410_gpio_getirq(pdev->resource[1].start), neo1973kbd);
> + free_irq(s3c2410_gpio_getirq(pdev->resource[0].start), neo1973kbd);
> +
> + input_unregister_device(neo1973kbd->input);
> + input_free_device(neo1973kbd->input);
Same here, input_free_device() is harmful here.
--
Dmitry
prev parent reply other threads:[~2008-01-03 17:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-18 11:08 [PATCH 8/12] neo1973: button input device driver Harald Welte
[not found] ` <4767AE27.1050201@dominion.kabel.utwente.nl>
2007-12-21 8:33 ` Harald Welte
2008-01-03 17:05 ` Dmitry Torokhov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d120d5000801030905h88b0edfy67c2f3fd562e3088@mail.gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=laforge@openmoko.org \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-input@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).