struct channel *lookup_chann_list(struct ksmbd_session *sess, struct ksmbd_conn *conn)
 {
        struct channel *chann;
-       struct list_head *t;
 
-       list_for_each(t, &sess->ksmbd_chann_list) {
-               chann = list_entry(t, struct channel, chann_list);
+       list_for_each_entry(chann, &sess->ksmbd_chann_list, chann_list) {
                if (chann && chann->conn == conn)
                        return chann;
        }
        struct smb2_hdr *hdr = work->request_buf;
        struct smb2_hdr *chdr;
        struct ksmbd_work *cancel_work = NULL;
-       struct list_head *tmp;
        int canceled = 0;
        struct list_head *command_list;
 
                command_list = &conn->async_requests;
 
                spin_lock(&conn->request_lock);
-               list_for_each(tmp, command_list) {
-                       cancel_work = list_entry(tmp, struct ksmbd_work,
-                                                async_request_entry);
+               list_for_each_entry(cancel_work, command_list,
+                                   async_request_entry) {
                        chdr = cancel_work->request_buf;
 
                        if (cancel_work->async_id !=
                command_list = &conn->requests;
 
                spin_lock(&conn->request_lock);
-               list_for_each(tmp, command_list) {
-                       cancel_work = list_entry(tmp, struct ksmbd_work,
-                                                request_entry);
+               list_for_each_entry(cancel_work, command_list, request_entry) {
                        chdr = cancel_work->request_buf;
 
                        if (chdr->MessageId != hdr->MessageId ||
 
 {
        int rc = 0;
        struct ksmbd_file *prev_fp;
-       struct list_head *cur;
 
        /*
         * Lookup fp in master fp list, and check desired access and
         * shared mode between previous open and current open.
         */
        read_lock(&curr_fp->f_ci->m_lock);
-       list_for_each(cur, &curr_fp->f_ci->m_fp_list) {
-               prev_fp = list_entry(cur, struct ksmbd_file, node);
+       list_for_each_entry(prev_fp, &curr_fp->f_ci->m_fp_list, node) {
                if (file_inode(filp) != FP_INODE(prev_fp))
                        continue;
 
 
 {
        struct ksmbd_file       *lfp;
        struct ksmbd_inode      *ci;
-       struct list_head        *cur;
 
        ci = ksmbd_inode_lookup_by_vfsinode(inode);
        if (!ci)
                return NULL;
 
        read_lock(&ci->m_lock);
-       list_for_each(cur, &ci->m_fp_list) {
-               lfp = list_entry(cur, struct ksmbd_file, node);
+       list_for_each_entry(lfp, &ci->m_fp_list, node) {
                if (inode == FP_INODE(lfp)) {
                        atomic_dec(&ci->m_count);
                        read_unlock(&ci->m_lock);