Skip to content

Commit

Permalink
Input: wm831x-ts - convert to devm_kzalloc()
Browse files Browse the repository at this point in the history
Saves a little code and eliminates the possibility of introducing some
leaks.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Mark Brown authored and Dmitry Torokhov committed Oct 11, 2012
1 parent 2f7badb commit ef8dee5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/input/touchscreen/wm831x-ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -376,7 +377,6 @@ static __devinit int wm831x_ts_probe(struct platform_device *pdev)
free_irq(wm831x_ts->data_irq, wm831x_ts);
err_alloc:
input_free_device(input_dev);
kfree(wm831x_ts);

return error;
}
Expand All @@ -388,7 +388,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;
}
Expand Down

0 comments on commit ef8dee5

Please sign in to comment.