NTB: remove all the checks of the return values.
Subsystems (2)
PATCH 1/1 NTB: remove all the checks of the return values.
The comments in debugfs_create_dir and debugfs_create_file point out that, generally, we do not need to check the return arguments of the functions. In this case, it will be useful to delete all the checks
about the return arguments.
Signed-off-by Jintao Huang <[email protected]>
Reviewed-by Dongliang Mu <[email protected]>
---
This issue is found by static analyzer. The patched code has passed Smatch checker, but remains untested on concrete running.
--- drivers/ntb/hw/amd/ntb_hw_amd.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-)
drivers/ntb/hw/amd/ntb_hw_amd.c +7 -15
@@ -934,21 +934,13 @@ static ssize_t ndev_debugfs_read(struct file *filp, char __user *ubuf,static void ndev_init_debugfs (struct amd_ntb_dev *ndev) { -if (!debugfs_dir) { - ndev->debugfs_dir =NULL ; - ndev->debugfs_info =NULL ; - }else { - ndev->debugfs_dir = -debugfs_create_dir (pci_name (ndev->ntb.pdev), - debugfs_dir); -if (!ndev->debugfs_dir) - ndev->debugfs_info =NULL ; -else - ndev->debugfs_info = -debugfs_create_file ("info" ,S_IRUSR , - ndev->debugfs_dir, ndev, - &amd_ntb_debugfs_info); - } + ndev->debugfs_dir = +debugfs_create_dir (pci_name (ndev->ntb.pdev), + debugfs_dir); + ndev->debugfs_info = +debugfs_create_file ("info" ,0400 , + ndev->debugfs_dir, ndev, + &amd_ntb_debugfs_info); }static void ndev_deinit_debugfs (struct amd_ntb_dev *ndev)
Signature · 1 line
2.34.1