mhi: dev: netdev: Update logic for valid access of dentry variable

Variable "dentry" is valid only if "CONFIG_DEBUG_FS" is set.
Update logic such that "dentry" variable is accessed during
debugfs removal only in valid condition.

Change-Id: I2a1e3e7f312cf316c94e930e15e9528fbeedb9a1
Signed-off-by: Nitesh Gupta <nitegupt@codeaurora.org>
This commit is contained in:
Nitesh Gupta 2020-10-12 15:44:03 +05:30
commit 562e6c175b

View file

@ -918,9 +918,14 @@ static void mhi_netdev_create_debugfs_dir(void)
dentry = debugfs_create_dir(MHI_NETDEV_DRIVER_NAME, 0);
}
static void mhi_netdev_debugfs_remove(void)
{
debugfs_remove_recursive(dentry);
}
#else
static void mhi_netdev_create_debugfs(struct mhi_netdev_private *mhi_netdev)
static void mhi_netdev_create_debugfs(struct mhi_netdev *mhi_netdev)
{
}
@ -928,6 +933,10 @@ static void mhi_netdev_create_debugfs_dir(void)
{
}
static void mhi_netdev_debugfs_remove(void)
{
}
#endif
static void mhi_netdev_remove(struct mhi_device *mhi_dev)
@ -1141,8 +1150,7 @@ module_init(mhi_netdev_init);
static void __exit mhi_netdev_exit(void)
{
debugfs_remove_recursive(dentry);
mhi_netdev_debugfs_remove();
mhi_driver_unregister(&mhi_netdev_driver);
}
module_exit(mhi_netdev_exit);