usb: dwc3: Check return value for debugfs_create_dir()
debugfs_create_dir() returns NULL when second directory is created
with same name gsi-epin. Without checking return value
dwc3_debugfs_create_endpoint_dir() creates endpoint files with parent
as NULL. This would create files in root dir /sys/kernel/debug which
remains there even after calling debugfs_remove_recursive() from
dwc3_debugfs_exit(). Due to probe deferral dwc3 endpoints get freed
up and re-allocated. As a result accessing endpoint files created in
root dir causes access to stale dwc3 endpoint pointer. Hence check
return value for debugfs_create_dir and do not create files for NULL
parent.
Change-Id: I44b65b77f35be1a52e71db2184a359887c25c8c9
Signed-off-by:
Hemant Kumar <hemantk@codeaurora.org>
Loading
Please register or sign in to comment