Skip to content

Commit dd070a5

Browse files
Alexander Aringteigland
authored andcommitted
fs: dlm: use list_first_entry_or_null
Instead of check on list_empty() we can do the same with list_first_entry_or_null() and return NULL if the returned value is NULL. Signed-off-by: Alexander Aring <[email protected]> Signed-off-by: David Teigland <[email protected]>
1 parent 01ea3d7 commit dd070a5

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

fs/dlm/lowcomms.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,12 @@ static struct writequeue_entry *con_next_wq(struct connection *con)
214214
{
215215
struct writequeue_entry *e;
216216

217-
if (list_empty(&con->writequeue))
218-
return NULL;
219-
220-
e = list_first_entry(&con->writequeue, struct writequeue_entry,
221-
list);
217+
e = list_first_entry_or_null(&con->writequeue, struct writequeue_entry,
218+
list);
222219
/* if len is zero nothing is to send, if there are users filling
223220
* buffers we wait until the users are done so we can send more.
224221
*/
225-
if (e->users || e->len == 0)
222+
if (!e || e->users || e->len == 0)
226223
return NULL;
227224

228225
return e;

0 commit comments

Comments
 (0)