bus: mhi: host: Fix controller cleanup on EDL sysfs failure
Subsystems (2)
PATCH 1/1 bus: mhi: host: Fix controller cleanup on EDL sysfs failure
mhi_register_controller() adds the controller device before creating the optional trigger_edl sysfs file. If sysfs_create_file() fails, the error path only drops the device reference and leaves the device registered.
Add a post-device_add() error path that calls device_del() before put_device(), matching the normal unregister path.
--- drivers/bus/mhi/host/init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/bus/mhi/host/init.c +3 -1
@@ -1029,7 +1029,7 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl,if (mhi_cntrl->edl_trigger) { ret =sysfs_create_file (&mhi_dev->dev.kobj, &dev_attr_trigger_edl.attr);if (ret) - goto err_release_dev; + goto err_del_dev; } mhi_cntrl->mhi_dev = mhi_dev;
@@ -1038,6 +1038,8 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl,return 0 ; +err_del_dev: +device_del (&mhi_dev->dev); err_release_dev:put_device (&mhi_dev->dev); error_setup_irq:
Signature · 1 line
2.43.0
Manivannan Sadhasivam
AppliedQuoted 8 lines · Yuho Choi
mhi_register_controller()adds the controller device before creating the optionaltrigger_edlsysfs file. Ifsysfs_create_file()fails, the error path only drops the device reference and leaves the device registered.Add a post-device_add() error path that calls
device_del()beforeput_device(), matching the normal unregister path.[...]
Applied, thanks!
[1/1] bus: mhi: host: Fix controller cleanup on EDL sysfs failure
commit: df0da14720337107da54ceacd310a21855d24225
Best regards,
Signature · 1 line
மணிவண்ணன் சதாசிவம்