lkml.org 
[lkml]   [2013]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/4] input: keyboard: tegra: use devm_* for resource allocation
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


\
 
 \ /
  Last update: 2013-01-05 13:01    [W:0.921 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site