[PATCH v2] OMAP3: Keypad: Fix failure exit path in probe

G, Manjunath Kondaiah manjugk at ti.com
Mon Oct 4 04:02:29 EDT 2010


Dmitry,
As agreed, can you push this patch?
https://patchwork.kernel.org/patch/197442/

-Manjunath

> -----Original Message-----
> From: Dmitry Torokhov [mailto:dmitry.torokhov at gmail.com] 
> Sent: Tuesday, September 21, 2010 9:57 PM
> To: G, Manjunath Kondaiah
> Cc: Ameya Palande; linux-omap at vger.kernel.org; 
> linux-input at vger.kernel.org; 
> linux-arm-kernel at lists.infradead.org; Tony Lindgren
> Subject: Re: [PATCH v2] OMAP3: Keypad: Fix failure exit path in probe
> 
> Hi,
> 
> On Tue, Sep 21, 2010 at 07:11:01PM +0530, G, Manjunath Kondaiah wrote:
> > 
> > Hi,
> > 
> > > -----Original Message-----
> > > From: Ameya Palande [mailto:ameya.palande at nokia.com]
> > > Sent: Tuesday, September 21, 2010 7:04 PM
> > > To: G, Manjunath Kondaiah
> > > Cc: linux-omap at vger.kernel.org; 
> linux-input at vger.kernel.org; Dmitry 
> > > Torokhov; linux-arm-kernel at lists.infradead.org; Tony Lindgren
> > > Subject: Re: [PATCH v2] OMAP3: Keypad: Fix failure exit path in 
> > > probe
> > > 
> > > Hi Manjunath,
> > > 
> > > On Tue, 2010-09-21 at 13:49 +0200, ext G, Manjunath 
> Kondaiah wrote:
> > > > The failure exit paths seems to be wrong in probe function.
> > > > This patch corrects exit failure paths for error handling cases.
> > > 
> 
> And also adds memory leak...
> 
> 
> > > https://patchwork.kernel.org/patch/160551/
> > > Any comments on this?
> > 
> > Looks fine. Sorry, I didn't look at the change. This 
> version seems to 
> > be better.
> > 
> 
> I do not understand why we need to separate memory 
> allocations. It looks
> like the minimal patch should be like one below.
> 
> Thanks.
> 
> -- 
> Dmitry
> 
> 
> Input: twl4030_keypad - fix error handling path
> 
> From: Dmitry Torokhov <dmitry.torokhov at gmail.com>
> 
> We should not try to call free_irq() when request_irq() failed.
> 
> Reported-by: G, Manjunath Kondaiah <manjugk at ti.com>
> Signed-off-by: Dmitry Torokhov <dtor at mail.ru>
> ---
> 
>  drivers/input/keyboard/twl4030_keypad.c |    7 +++----
>  1 files changed, 3 insertions(+), 4 deletions(-)
> 
> 
> diff --git a/drivers/input/keyboard/twl4030_keypad.c 
> b/drivers/input/keyboard/twl4030_keypad.c
> index fb16b5e..09bef79 100644
> --- a/drivers/input/keyboard/twl4030_keypad.c
> +++ b/drivers/input/keyboard/twl4030_keypad.c
> @@ -406,23 +406,22 @@ static int __devinit 
> twl4030_kp_probe(struct platform_device *pdev)
>  	if (error) {
>  		dev_info(kp->dbg_dev, "request_irq failed for 
> irq no=%d\n",
>  			kp->irq);
> -		goto err3;
> +		goto err2;
>  	}
>  
>  	/* Enable KP and TO interrupts now. */
>  	reg = (u8) ~(KEYP_IMR1_KP | KEYP_IMR1_TO);
>  	if (twl4030_kpwrite_u8(kp, reg, KEYP_IMR1)) {
>  		error = -EIO;
> -		goto err4;
> +		goto err3;
>  	}
>  
>  	platform_set_drvdata(pdev, kp);
>  	return 0;
>  
> -err4:
> +err3:
>  	/* mask all events - we don't care about the result */
>  	(void) twl4030_kpwrite_u8(kp, 0xff, KEYP_IMR1);
> -err3:
>  	free_irq(kp->irq, NULL);
>  err2:
>  	input_unregister_device(input);
> 


More information about the linux-arm-kernel mailing list