Re: [PATCH -next] cifsd: fix WARNING: convert list_for_each to entry variant in smb2pdu.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I don't know what the difference is between

list_for_each_entry() and list_for_each() for 'struct channel *chann',

but I don't think there's any difference here.

Would you give me more detial about this, please?

Thank you.

Best Regards.


在 2021/6/17 17:26, Dan Carpenter 写道:
On Thu, Jun 17, 2021 at 02:46:53PM +0800, Baokun Li wrote:
convert list_for_each() to list_for_each_entry() where
applicable.

Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
Signed-off-by: Baokun Li <libaokun1@xxxxxxxxxx>
---
  fs/cifsd/smb2pdu.c | 15 ++++-----------
  1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/fs/cifsd/smb2pdu.c b/fs/cifsd/smb2pdu.c
index ac15a9287310..22ef1d9eed1b 100644
--- a/fs/cifsd/smb2pdu.c
+++ b/fs/cifsd/smb2pdu.c
@@ -74,10 +74,7 @@ static inline int check_session_id(struct ksmbd_conn *conn, u64 id)
  struct channel *lookup_chann_list(struct ksmbd_session *sess)
  {
  	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 == sess->conn)
"chan" is the list iterator and it can't be NULL.

  			return chann;
  	}
regards,
dan carpenter

.



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux