Input: stmpe-ts - remove input_free_device() in stmpe_ts_remove()
Subsystems (3)
PATCH 1/2 Input: stmpe-ts - remove input_free_device() in stmpe_ts_remove()
No need to call input_free_device() after input_unregister_device().
--- drivers/input/touchscreen/stmpe-ts.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/input/touchscreen/stmpe-ts.c +0 -1
@@ -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);
Signature · 1 line
1.7.2
PATCH 2/2 Input: stmpe-ts - return -ENOMEM if memory allocation fail
--- drivers/input/touchscreen/stmpe-ts.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/input/touchscreen/stmpe-ts.c +6 -2
@@ -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;
Signature · 1 line
1.7.2
Re: [PATCH 2/2] Input: stmpe-ts - return -ENOMEM if memory allocation fail
Quoted 1 line · Axel Lin
Signed-off-by Axel Lin <[email protected]>
Basically correct. Should be simpler to just use
int ret = -ENOMEM;
though.
Quoted 33 lines
--- drivers/input/touchscreen/stmpe-ts.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)drivers/input/touchscreen/stmpe-ts.c +6
-2@@ -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;Signature · 1 line
1.7.2
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Dmitry Torokhov
maintainerRe: [PATCH 2/2] Input: stmpe-ts - return -ENOMEM if memory allocation fail
Quoted 9 lines · Wolfram Sang
Quoted 1 line · Axel Lin
Signed-off-by Axel Lin <[email protected]>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.
Signature · 1 line
Dmitry
Re: [PATCH 2/2] Input: stmpe-ts - return -ENOMEM if memory allocation fail
Quoted 4 lines · Dmitry Torokhov
Quoted 3 lines · Wolfram Sang
Quoted 1 line · Axel Lin
Signed-off-by Axel Lin <[email protected]>
Quoted 8 lines
Quoted 6 lines
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 :)
Quoted 4 lines
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.
Quoted 1 line
Please explicitly assign error codes in error handling path.
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Hi,
Quoted 2 lines · Axel Lin
No need to call
input_free_device()afterinput_unregister_device().
yeah right. The device is input_unregister_device unregisters the device already. Thx for fixing this.
Quoted 18 lines
Signed-off-by Axel Lin <[email protected]>---
drivers/input/touchscreen/stmpe-ts.c | 1 -1 files changed, 0 insertions(+), 1 deletions(-)drivers/input/touchscreen/stmpe-ts.c +0
-2@@ -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); --
Quoted 5 lines
1.7.2
cheers
Luotao Fu
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html