Skip to content

Commit a4f399a

Browse files
tititiou36broonie
authored andcommitted
Input: wm97xx: Simplify resource management
Since the commit in the Fixes tag below, 'wm->input_dev' is a managed resource that doesn't need to be explicitly unregistered or freed (see devm_input_allocate_device() documentation) So, remove some unless line of code to slightly simplify it. Fixes: c72f61e ("Input: wm97xx: split out touchscreen registering") Signed-off-by: Christophe JAILLET <[email protected]> Acked-by: Charles Keepax <[email protected]> Link: https://lore.kernel.org/r/87dce7e80ea9b191843fa22415ca3aef5f3cc2e6.1643529968.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown <[email protected]>
1 parent 1601033 commit a4f399a

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

drivers/input/touchscreen/wm97xx-core.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -615,10 +615,9 @@ static int wm97xx_register_touch(struct wm97xx *wm)
615615
* extensions)
616616
*/
617617
wm->touch_dev = platform_device_alloc("wm97xx-touch", -1);
618-
if (!wm->touch_dev) {
619-
ret = -ENOMEM;
620-
goto touch_err;
621-
}
618+
if (!wm->touch_dev)
619+
return -ENOMEM;
620+
622621
platform_set_drvdata(wm->touch_dev, wm);
623622
wm->touch_dev->dev.parent = wm->dev;
624623
wm->touch_dev->dev.platform_data = pdata;
@@ -629,18 +628,13 @@ static int wm97xx_register_touch(struct wm97xx *wm)
629628
return 0;
630629
touch_reg_err:
631630
platform_device_put(wm->touch_dev);
632-
touch_err:
633-
input_unregister_device(wm->input_dev);
634-
wm->input_dev = NULL;
635631

636632
return ret;
637633
}
638634

639635
static void wm97xx_unregister_touch(struct wm97xx *wm)
640636
{
641637
platform_device_unregister(wm->touch_dev);
642-
input_unregister_device(wm->input_dev);
643-
wm->input_dev = NULL;
644638
}
645639

646640
static int _wm97xx_probe(struct wm97xx *wm)

0 commit comments

Comments
 (0)