mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-03-11 23:27:42 +07:00
staging: lustre: Deletion of unnecessary checks before three function calls
The following functions test whether their argument is NULL and then return immediately. * kfree * ll_file_data_put * ptlrpc_connection_put Thus the test around such calls is not needed. This issue was detected by using the Coccinelle software. See also a previous update suggestion: "remove unneeded null test before free" by Julia Lawall https://lkml.org/lkml/2015/5/1/498 https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg878600.html Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
5f37ac9343
commit
a5cb88804d
@ -702,8 +702,7 @@ int ll_file_open(struct inode *inode, struct file *file)
|
||||
out_openerr:
|
||||
if (opendir_set != 0)
|
||||
ll_stop_statahead(inode, lli->lli_opendir_key);
|
||||
if (fd != NULL)
|
||||
ll_file_data_put(fd);
|
||||
ll_file_data_put(fd);
|
||||
} else {
|
||||
ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_OPEN, 1);
|
||||
}
|
||||
|
@ -1114,7 +1114,7 @@ void ll_clear_inode(struct inode *inode)
|
||||
if (lli->lli_mds_read_och)
|
||||
ll_md_real_close(inode, FMODE_READ);
|
||||
|
||||
if (S_ISLNK(inode->i_mode) && lli->lli_symlink_name) {
|
||||
if (S_ISLNK(inode->i_mode)) {
|
||||
kfree(lli->lli_symlink_name);
|
||||
lli->lli_symlink_name = NULL;
|
||||
}
|
||||
|
@ -555,14 +555,12 @@ static int import_select_connection(struct obd_import *imp)
|
||||
imp_conn->oic_last_attempt = cfs_time_current_64();
|
||||
|
||||
/* switch connection, don't mind if it's same as the current one */
|
||||
if (imp->imp_connection)
|
||||
ptlrpc_connection_put(imp->imp_connection);
|
||||
ptlrpc_connection_put(imp->imp_connection);
|
||||
imp->imp_connection = ptlrpc_connection_addref(imp_conn->oic_conn);
|
||||
|
||||
dlmexp = class_conn2export(&imp->imp_dlm_handle);
|
||||
LASSERT(dlmexp != NULL);
|
||||
if (dlmexp->exp_connection)
|
||||
ptlrpc_connection_put(dlmexp->exp_connection);
|
||||
ptlrpc_connection_put(dlmexp->exp_connection);
|
||||
dlmexp->exp_connection = ptlrpc_connection_addref(imp_conn->oic_conn);
|
||||
class_export_put(dlmexp);
|
||||
|
||||
|
@ -2826,9 +2826,7 @@ void ptlrpc_hr_fini(void)
|
||||
ptlrpc_stop_hr_threads();
|
||||
|
||||
cfs_percpt_for_each(hrp, i, ptlrpc_hr.hr_partitions) {
|
||||
if (hrp->hrp_thrs != NULL) {
|
||||
kfree(hrp->hrp_thrs);
|
||||
}
|
||||
kfree(hrp->hrp_thrs);
|
||||
}
|
||||
|
||||
cfs_percpt_free(ptlrpc_hr.hr_partitions);
|
||||
|
Loading…
Reference in New Issue
Block a user