[PATCH v2 2/4] input: keyboard: tegra: use devm_* for resource allocation
Laxman Dewangan
ldewangan at nvidia.com
Sat Jan 5 22:20:58 EST 2013
HI Dmitry,
Thanks for quick review.
I will take care of your comment in next version. Some have my answer.
On Saturday 05 January 2013 01:36 PM, Dmitry Torokhov wrote:
> Hi Laxman,
>
> On Sat, Jan 05, 2013 at 01:15:08PM +0530, Laxman Dewangan wrote:
>> Use devm_* for memory, clock, input device allocation. This reduces
>> code for freeing these resources.
>> err = tegra_kbd_setup_keymap(kbc);
>> - if (err) {
>> + if (err < 0) {
> Why is this change? As far as I can see tegra_kbd_setup_keymap() never
> returns positive values.
Ok, mostly errors are in negative and hence this change, I will revert
it and will keep original.
>
>> dev_err(&pdev->dev, "failed to setup keymap\n");
>> - goto err_put_clk;
>> + return err;
>> }
>>
>> __set_bit(EV_REP, input_dev->evbit);
>> @@ -790,15 +784,15 @@ static int tegra_kbc_probe(struct platform_device *pdev)
>>
>> err = request_irq(kbc->irq, tegra_kbc_isr,
>> IRQF_NO_SUSPEND | IRQF_TRIGGER_HIGH, pdev->name, kbc);
>> - if (err) {
>> + if (err < 0) {
> Neither request_irq(). BTW, why not devm_request_irq?
I understand from Mark B on different patches that using
devm_request_irq() can create race condition when removing device.
Interrupt can occur when device resource release is in process and so it
can cause isr call which can use the freed pointer. devm_request_irq()
should be avoided.
Thanks,
Laxman
More information about the devicetree-discuss
mailing list