From 325eadca9f7dbb9f5d83a4dfbc05eeeacceb02f3 Mon Sep 17 00:00:00 2001 From: Mark Fasheh Date: Wed, 19 Jul 2017 19:10:56 -0500 Subject: [PATCH] scoutfs: check for NULL lock in scoutfs_unlock This reduces the amount of duplicate code in callers and makes error handling easier. The alternative is to sprinkle the code with 'if (lock)' lines at the end of our functions. Signed-off-by: Mark Fasheh --- kmod/src/lock.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kmod/src/lock.c b/kmod/src/lock.c index 71a64952..0d5455fb 100644 --- a/kmod/src/lock.c +++ b/kmod/src/lock.c @@ -513,6 +513,9 @@ void scoutfs_unlock(struct super_block *sb, struct scoutfs_lock *lock) { DECLARE_LOCK_INFO(sb, linfo); + if (!lock) + return; + trace_scoutfs_unlock(sb, lock); spin_lock(&linfo->lock);