extcon: fix possible name leak in extcon_dev_register()
authorYaxiong Tian <tianyaxiong@kylinos.cn>
Fri, 24 Nov 2023 01:49:13 +0000 (09:49 +0800)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 4 Dec 2023 12:47:19 +0000 (21:47 +0900)
commite66523c72c9aae0ff0dae6859eb77b04de1e8e5f
treed8cf42b3481a454b7daaa9f8c409e6a766b154e6
parentb85ea95d086471afb4ad062012a4d73cd328fa86
extcon: fix possible name leak in extcon_dev_register()

In the error path after calling dev_set_name(), the device
name is leaked. To fix this, moving dev_set_name() after the
error path and before device_register.

Link: https://lore.kernel.org/lkml/TYZPR01MB4784ADCD3E951E0863F3DB72D5B8A@TYZPR01MB4784.apcprd01.prod.exchangelabs.com/
Signed-off-by: Yaxiong Tian <tianyaxiong@kylinos.cn>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
drivers/extcon/extcon.c