linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Input: stmpe-ts - remove input_free_device() in stmpe_ts_remove()
@ 2010-09-03  1:30 Axel Lin
  2010-09-03  1:32 ` [PATCH 2/2] Input: stmpe-ts - return -ENOMEM if memory allocation fail Axel Lin
  2010-09-03  7:13 ` [PATCH 1/2] Input: stmpe-ts - remove input_free_device() in stmpe_ts_remove() Luotao Fu
  0 siblings, 2 replies; 6+ messages in thread
From: Axel Lin @ 2010-09-03  1:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Luotao Fu, Dmitry Torokhov, linux-input

No need to call input_free_device() after input_unregister_device().

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/input/touchscreen/stmpe-ts.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c
index 656148e..0339d1d 100644
--- a/drivers/input/touchscreen/stmpe-ts.c
+++ b/drivers/input/touchscreen/stmpe-ts.c
@@ -361,7 +361,6 @@ static int __devexit stmpe_ts_remove(struct platform_device *pdev)
 	platform_set_drvdata(pdev, NULL);
 
 	input_unregister_device(ts->idev);
-	input_free_device(ts->idev);
 
 	kfree(ts);
 
-- 
1.7.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] Input: stmpe-ts - return -ENOMEM if memory allocation fail
  2010-09-03  1:30 [PATCH 1/2] Input: stmpe-ts - remove input_free_device() in stmpe_ts_remove() Axel Lin
@ 2010-09-03  1:32 ` Axel Lin
  2010-09-03 21:35   ` Wolfram Sang
  2010-09-03  7:13 ` [PATCH 1/2] Input: stmpe-ts - remove input_free_device() in stmpe_ts_remove() Luotao Fu
  1 sibling, 1 reply; 6+ messages in thread
From: Axel Lin @ 2010-09-03  1:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Luotao Fu, Dmitry Torokhov, linux-input

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/input/touchscreen/stmpe-ts.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c
index 0339d1d..e715b27 100644
--- a/drivers/input/touchscreen/stmpe-ts.c
+++ b/drivers/input/touchscreen/stmpe-ts.c
@@ -276,12 +276,16 @@ static int __devinit stmpe_input_probe(struct platform_device *pdev)
 		return ts_irq;
 
 	ts = kzalloc(sizeof(*ts), GFP_KERNEL);
-	if (!ts)
+	if (!ts) {
+		ret = -ENOMEM;
 		goto err_out;
+	}
 
 	idev = input_allocate_device();
-	if (!idev)
+	if (!idev) {
+		ret = -ENOMEM;
 		goto err_free_ts;
+	}
 
 	platform_set_drvdata(pdev, ts);
 	ts->stmpe = stmpe;
-- 
1.7.2




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] Input: stmpe-ts - remove input_free_device() in stmpe_ts_remove()
  2010-09-03  1:30 [PATCH 1/2] Input: stmpe-ts - remove input_free_device() in stmpe_ts_remove() Axel Lin
  2010-09-03  1:32 ` [PATCH 2/2] Input: stmpe-ts - return -ENOMEM if memory allocation fail Axel Lin
@ 2010-09-03  7:13 ` Luotao Fu
  1 sibling, 0 replies; 6+ messages in thread
From: Luotao Fu @ 2010-09-03  7:13 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Luotao Fu, Dmitry Torokhov, linux-input

Hi,

On Fri, Sep 3, 2010 at 3:30 AM, Axel Lin <axel.lin@gmail.com> wrote:
> No need to call input_free_device() after input_unregister_device().
>

yeah right. The device is input_unregister_device unregisters the
device already. Thx for fixing this.

Acked-by: Luotao Fu <devtty0@gmail.com>

> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
>  drivers/input/touchscreen/stmpe-ts.c |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c
> index 656148e..0339d1d 100644
> --- a/drivers/input/touchscreen/stmpe-ts.c
> +++ b/drivers/input/touchscreen/stmpe-ts.c
> @@ -361,7 +361,6 @@ static int __devexit stmpe_ts_remove(struct platform_device *pdev)
>        platform_set_drvdata(pdev, NULL);
>
>        input_unregister_device(ts->idev);
> -       input_free_device(ts->idev);
>
>        kfree(ts);
>
> --
> 1.7.2
>
>
>
>

cheers
Luotao Fu
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] Input: stmpe-ts - return -ENOMEM if memory allocation fail
  2010-09-03  1:32 ` [PATCH 2/2] Input: stmpe-ts - return -ENOMEM if memory allocation fail Axel Lin
@ 2010-09-03 21:35   ` Wolfram Sang
  2010-09-03 21:45     ` Dmitry Torokhov
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfram Sang @ 2010-09-03 21:35 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Luotao Fu, Dmitry Torokhov, linux-input

[-- Attachment #1: Type: text/plain, Size: 1160 bytes --]

On Fri, Sep 03, 2010 at 09:32:13AM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Basically correct. Should be simpler to just use

	int ret = -ENOMEM;

though.

> ---
>  drivers/input/touchscreen/stmpe-ts.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c
> index 0339d1d..e715b27 100644
> --- a/drivers/input/touchscreen/stmpe-ts.c
> +++ b/drivers/input/touchscreen/stmpe-ts.c
> @@ -276,12 +276,16 @@ static int __devinit stmpe_input_probe(struct platform_device *pdev)
>  		return ts_irq;
>  
>  	ts = kzalloc(sizeof(*ts), GFP_KERNEL);
> -	if (!ts)
> +	if (!ts) {
> +		ret = -ENOMEM;
>  		goto err_out;
> +	}
>  
>  	idev = input_allocate_device();
> -	if (!idev)
> +	if (!idev) {
> +		ret = -ENOMEM;
>  		goto err_free_ts;
> +	}
>  
>  	platform_set_drvdata(pdev, ts);
>  	ts->stmpe = stmpe;
> -- 
> 1.7.2
> 
> 
> 
> 

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] Input: stmpe-ts - return -ENOMEM if memory allocation fail
  2010-09-03 21:35   ` Wolfram Sang
@ 2010-09-03 21:45     ` Dmitry Torokhov
  2010-09-04  5:45       ` Wolfram Sang
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2010-09-03 21:45 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Axel Lin, linux-kernel, Luotao Fu, linux-input

On Fri, Sep 03, 2010 at 11:35:24PM +0200, Wolfram Sang wrote:
> On Fri, Sep 03, 2010 at 09:32:13AM +0800, Axel Lin wrote:
> > Signed-off-by: Axel Lin <axel.lin@gmail.com>
> 
> Basically correct. Should be simpler to just use
> 
> 	int ret = -ENOMEM;
> 
> though.
> 

No! I hate when people initialize error values like that, because it is
so easy to miss the case and end up with wrong value. If the original
version of the driver did not initialize it to 0 compiler would warn
the author and the error would not make it into the mainline to begin
with.

Please explicitly assign error codes in error handling path.

Thanks.


-- 
Dmitry

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] Input: stmpe-ts - return -ENOMEM if memory allocation fail
  2010-09-03 21:45     ` Dmitry Torokhov
@ 2010-09-04  5:45       ` Wolfram Sang
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2010-09-04  5:45 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Axel Lin, linux-kernel, Luotao Fu, linux-input

[-- Attachment #1: Type: text/plain, Size: 1003 bytes --]

On Fri, Sep 03, 2010 at 02:45:40PM -0700, Dmitry Torokhov wrote:
> On Fri, Sep 03, 2010 at 11:35:24PM +0200, Wolfram Sang wrote:
> > On Fri, Sep 03, 2010 at 09:32:13AM +0800, Axel Lin wrote:
> > > Signed-off-by: Axel Lin <axel.lin@gmail.com>
> > 
> > Basically correct. Should be simpler to just use
> > 
> > 	int ret = -ENOMEM;
> > 
> > though.
> > 
> 
> No! I hate when people initialize error values like that, because it is

Might be a mileage; I don't insist, though :)

> so easy to miss the case and end up with wrong value. If the original
> version of the driver did not initialize it to 0 compiler would warn
> the author and the error would not make it into the mainline to begin
> with.

So, the initialization to 0 could be removed, at least.

> Please explicitly assign error codes in error handling path.

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-09-04  5:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-03  1:30 [PATCH 1/2] Input: stmpe-ts - remove input_free_device() in stmpe_ts_remove() Axel Lin
2010-09-03  1:32 ` [PATCH 2/2] Input: stmpe-ts - return -ENOMEM if memory allocation fail Axel Lin
2010-09-03 21:35   ` Wolfram Sang
2010-09-03 21:45     ` Dmitry Torokhov
2010-09-04  5:45       ` Wolfram Sang
2010-09-03  7:13 ` [PATCH 1/2] Input: stmpe-ts - remove input_free_device() in stmpe_ts_remove() Luotao Fu

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).