aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm
diff options
context:
space:
mode:
authorAlexander Aring <aahringo@redhat.com>2022-11-17 17:11:48 -0500
committerDavid Teigland <teigland@redhat.com>2022-11-21 09:45:49 -0600
commitdd070a56e0fa36f03bcd09fbf1521c733cf2aa21 (patch)
tree88b8ef4820613dfe92d2b3d4019af3f4e720063c /fs/dlm
parent01ea3d7701cb52dece379384f8aa7b8840f1d7c7 (diff)
downloadlinux-dd070a56e0fa36f03bcd09fbf1521c733cf2aa21.tar.gz
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 <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm')
-rw-r--r--fs/dlm/lowcomms.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 3106e7f873447..d3302b10b37e0 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -214,15 +214,12 @@ static struct writequeue_entry *con_next_wq(struct connection *con)
{
struct writequeue_entry *e;
- if (list_empty(&con->writequeue))
- return NULL;
-
- e = list_first_entry(&con->writequeue, struct writequeue_entry,
- list);
+ e = list_first_entry_or_null(&con->writequeue, struct writequeue_entry,
+ list);
/* if len is zero nothing is to send, if there are users filling
* buffers we wait until the users are done so we can send more.
*/
- if (e->users || e->len == 0)
+ if (!e || e->users || e->len == 0)
return NULL;
return e;