Input: wm831x-ts - Remove unneeded clearing of driver data
Subsystems (3)
PATCH 1/3 Input: wm831x-ts - Remove unneeded clearing of driver data
This is unneeded, only a bound driver can use driver data and a driver relying on the state prior to probe() is buggy.
Signed-off-by Mark Brown <[email protected]>
--- drivers/input/touchscreen/wm831x-ts.c | 1 - 1 file changed, 1 deletion(-)
drivers/input/touchscreen/wm831x-ts.c +0 -1
@@ -389,7 +389,6 @@ static __devexit int wm831x_ts_remove(struct platform_device *pdev)input_unregister_device (wm831x_ts->input_dev);kfree (wm831x_ts); -platform_set_drvdata (pdev,NULL );return 0 ; }
Signature · 1 line
1.7.10
PATCH 2/3 Input: wm831x-ts - Convert to devm_kzalloc()
Saves a little code and eliminates the possibility of introducing some leaks.
Signed-off-by Mark Brown <[email protected]>
--- drivers/input/touchscreen/wm831x-ts.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/input/touchscreen/wm831x-ts.c +2 -3
@@ -245,7 +245,8 @@ static __devinit int wm831x_ts_probe(struct platform_device *pdev)if (core_pdata) pdata = core_pdata->touch; - wm831x_ts =kzalloc (sizeof (struct wm831x_ts ),GFP_KERNEL ); + wm831x_ts =devm_kzalloc (&pdev->dev,sizeof (struct wm831x_ts ), +GFP_KERNEL ); input_dev =input_allocate_device ();if (!wm831x_ts || !input_dev) { error = -ENOMEM ;
@@ -375,7 +376,6 @@ err_data_irq:free_irq (wm831x_ts->data_irq, wm831x_ts); err_alloc:input_free_device (input_dev); -kfree (wm831x_ts);return error; }
@@ -387,7 +387,6 @@ static __devexit int wm831x_ts_remove(struct platform_device *pdev)free_irq (wm831x_ts->pd_irq, wm831x_ts);free_irq (wm831x_ts->data_irq, wm831x_ts);input_unregister_device (wm831x_ts->input_dev); -kfree (wm831x_ts);return 0 ; }
Signature · 1 line
1.7.10
PATCH 3/3 Input: wm831x-on - Convert to devm_kzalloc()
In reply to Mark BrownSaves a small amount of code and reduces the potential for leaks.
Signed-off-by Mark Brown <[email protected]>
--- drivers/input/misc/wm831x-on.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/input/misc/wm831x-on.c +2 -3
@@ -76,7 +76,8 @@ static int __devinit wm831x_on_probe(struct platform_device *pdev)int irq =platform_get_irq (pdev,0 );int ret; - wm831x_on =kzalloc (sizeof (struct wm831x_on ),GFP_KERNEL ); + wm831x_on =devm_kzalloc (&pdev->dev,sizeof (struct wm831x_on ), +GFP_KERNEL );if (!wm831x_on) {dev_err (&pdev->dev,"Can't allocate data\n" );return -ENOMEM ;
@@ -120,7 +121,6 @@ err_irq: err_input_dev:input_free_device (wm831x_on->dev); err: -kfree (wm831x_on);return ret; }
@@ -132,7 +132,6 @@ static int __devexit wm831x_on_remove(struct platform_device *pdev)free_irq (irq, wm831x_on);cancel_delayed_work_sync (&wm831x_on->work);input_unregister_device (wm831x_on->dev); -kfree (wm831x_on);return 0 ; }
Signature · 1 line
1.7.10