mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 20:48:49 +08:00
ksmbd: remove unneeded NULL check in the list iterator
Remove unneeded NULL check in the list iterator. And use list_for_each_entry_safe instead of list_for_each_safe. Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
ee81cae1a6
commit
560ac05130
@ -30,15 +30,12 @@ struct ksmbd_session_rpc {
|
||||
|
||||
static void free_channel_list(struct ksmbd_session *sess)
|
||||
{
|
||||
struct channel *chann;
|
||||
struct list_head *tmp, *t;
|
||||
struct channel *chann, *tmp;
|
||||
|
||||
list_for_each_safe(tmp, t, &sess->ksmbd_chann_list) {
|
||||
chann = list_entry(tmp, struct channel, chann_list);
|
||||
if (chann) {
|
||||
list_del(&chann->chann_list);
|
||||
kfree(chann);
|
||||
}
|
||||
list_for_each_entry_safe(chann, tmp, &sess->ksmbd_chann_list,
|
||||
chann_list) {
|
||||
list_del(&chann->chann_list);
|
||||
kfree(chann);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ struct channel *lookup_chann_list(struct ksmbd_session *sess, struct ksmbd_conn
|
||||
struct channel *chann;
|
||||
|
||||
list_for_each_entry(chann, &sess->ksmbd_chann_list, chann_list) {
|
||||
if (chann && chann->conn == conn)
|
||||
if (chann->conn == conn)
|
||||
return chann;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user