Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: wm831x-on - convert to devm_kzalloc()

Saves a small amount of code and reduces the potential for leaks.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Mark Brown and committed by
Dmitry Torokhov
dae6ba4a ef8dee5c

+2 -3
+2 -3
drivers/input/misc/wm831x-on.c
··· 76 76 int irq = wm831x_irq(wm831x, platform_get_irq(pdev, 0)); 77 77 int ret; 78 78 79 - wm831x_on = kzalloc(sizeof(struct wm831x_on), GFP_KERNEL); 79 + wm831x_on = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_on), 80 + GFP_KERNEL); 80 81 if (!wm831x_on) { 81 82 dev_err(&pdev->dev, "Can't allocate data\n"); 82 83 return -ENOMEM; ··· 121 120 err_input_dev: 122 121 input_free_device(wm831x_on->dev); 123 122 err: 124 - kfree(wm831x_on); 125 123 return ret; 126 124 } 127 125 ··· 132 132 free_irq(irq, wm831x_on); 133 133 cancel_delayed_work_sync(&wm831x_on->work); 134 134 input_unregister_device(wm831x_on->dev); 135 - kfree(wm831x_on); 136 135 137 136 return 0; 138 137 }