projects
/
GitHub
/
moto-9609
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
95ace75
)
locks: use list_first_entry_or_null()
author
Geliang Tang
<geliangtang@163.com>
Wed, 18 Nov 2015 13:40:33 +0000
(21:40 +0800)
committer
Jeff Layton
<jeff.layton@primarydata.com>
Wed, 18 Nov 2015 14:21:49 +0000
(09:21 -0500)
Simplify the code with list_first_entry_or_null().
Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
fs/locks.c
patch
|
blob
|
blame
|
history
diff --git
a/fs/locks.c
b/fs/locks.c
index 86c94674ab22dcfb53d6d186c689150de54f78ad..d2ee8e365ba795e796485f57cba1a62750bfa84f 100644
(file)
--- a/
fs/locks.c
+++ b/
fs/locks.c
@@
-1505,12
+1505,10
@@
void lease_get_mtime(struct inode *inode, struct timespec *time)
ctx = smp_load_acquire(&inode->i_flctx);
if (ctx && !list_empty_careful(&ctx->flc_lease)) {
spin_lock(&ctx->flc_lock);
- if (!list_empty(&ctx->flc_lease)) {
- fl = list_first_entry(&ctx->flc_lease,
- struct file_lock, fl_list);
- if (fl->fl_type == F_WRLCK)
- has_lease = true;
- }
+ fl = list_first_entry_or_null(&ctx->flc_lease,
+ struct file_lock, fl_list);
+ if (fl && (fl->fl_type == F_WRLCK))
+ has_lease = true;
spin_unlock(&ctx->flc_lock);
}