* [PATCH 1/3] Input: wm831x-ts - Remove unneeded clearing of driver data
@ 2012-04-18 17:28 Mark Brown
2012-04-18 17:28 ` [PATCH 2/3] Input: wm831x-ts - Convert to devm_kzalloc() Mark Brown
2012-04-18 17:28 ` [PATCH 3/3] Input: wm831x-on " Mark Brown
0 siblings, 2 replies; 4+ messages in thread
From: Mark Brown @ 2012-04-18 17:28 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, Mark Brown
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 <broonie@opensource.wolfsonmicro.com>
---
drivers/input/touchscreen/wm831x-ts.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/input/touchscreen/wm831x-ts.c b/drivers/input/touchscreen/wm831x-ts.c
index 4bc851a..d81482e 100644
--- a/drivers/input/touchscreen/wm831x-ts.c
+++ b/drivers/input/touchscreen/wm831x-ts.c
@@ -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;
}
--
1.7.10
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] Input: wm831x-ts - Convert to devm_kzalloc()
2012-04-18 17:28 [PATCH 1/3] Input: wm831x-ts - Remove unneeded clearing of driver data Mark Brown
@ 2012-04-18 17:28 ` Mark Brown
2012-04-18 17:28 ` [PATCH 3/3] Input: wm831x-on " Mark Brown
1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2012-04-18 17:28 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, Mark Brown
Saves a little code and eliminates the possibility of introducing some
leaks.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/input/touchscreen/wm831x-ts.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/input/touchscreen/wm831x-ts.c b/drivers/input/touchscreen/wm831x-ts.c
index d81482e..e34c10a 100644
--- a/drivers/input/touchscreen/wm831x-ts.c
+++ b/drivers/input/touchscreen/wm831x-ts.c
@@ -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;
}
--
1.7.10
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] Input: wm831x-on - Convert to devm_kzalloc()
2012-04-18 17:28 [PATCH 1/3] Input: wm831x-ts - Remove unneeded clearing of driver data Mark Brown
2012-04-18 17:28 ` [PATCH 2/3] Input: wm831x-ts - Convert to devm_kzalloc() Mark Brown
@ 2012-04-18 17:28 ` Mark Brown
1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2012-04-18 17:28 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, Mark Brown
Saves a small amount of code and reduces the potential for leaks.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/input/misc/wm831x-on.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/input/misc/wm831x-on.c b/drivers/input/misc/wm831x-on.c
index 47f18d6..aee53fb 100644
--- a/drivers/input/misc/wm831x-on.c
+++ b/drivers/input/misc/wm831x-on.c
@@ -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;
}
--
1.7.10
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 1/3] Input: wm831x-ts - Remove unneeded clearing of driver data
@ 2012-10-10 13:20 Mark Brown
2012-10-10 13:20 ` [PATCH 3/3] Input: wm831x-on - Convert to devm_kzalloc() Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2012-10-10 13:20 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, Mark Brown
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 <broonie@opensource.wolfsonmicro.com>
---
drivers/input/touchscreen/wm831x-ts.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/input/touchscreen/wm831x-ts.c b/drivers/input/touchscreen/wm831x-ts.c
index 52abb98..bf0a4a6 100644
--- a/drivers/input/touchscreen/wm831x-ts.c
+++ b/drivers/input/touchscreen/wm831x-ts.c
@@ -390,7 +390,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;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] Input: wm831x-on - Convert to devm_kzalloc()
2012-10-10 13:20 [PATCH 1/3] Input: wm831x-ts - Remove unneeded clearing of driver data Mark Brown
@ 2012-10-10 13:20 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2012-10-10 13:20 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, Mark Brown
Saves a small amount of code and reduces the potential for leaks.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/input/misc/wm831x-on.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/input/misc/wm831x-on.c b/drivers/input/misc/wm831x-on.c
index 6790a81..fa8b390 100644
--- a/drivers/input/misc/wm831x-on.c
+++ b/drivers/input/misc/wm831x-on.c
@@ -76,7 +76,8 @@ static int __devinit wm831x_on_probe(struct platform_device *pdev)
int irq = wm831x_irq(wm831x, 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;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-10-11 7:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-18 17:28 [PATCH 1/3] Input: wm831x-ts - Remove unneeded clearing of driver data Mark Brown
2012-04-18 17:28 ` [PATCH 2/3] Input: wm831x-ts - Convert to devm_kzalloc() Mark Brown
2012-04-18 17:28 ` [PATCH 3/3] Input: wm831x-on " Mark Brown
-- strict thread matches above, loose matches on Subject: below --
2012-10-10 13:20 [PATCH 1/3] Input: wm831x-ts - Remove unneeded clearing of driver data Mark Brown
2012-10-10 13:20 ` [PATCH 3/3] Input: wm831x-on - Convert to devm_kzalloc() Mark Brown
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).