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 <mfasheh@versity.com>
This commit is contained in:
Mark Fasheh
2017-07-19 19:10:56 -05:00
committed by Zach Brown
parent 4ff2148f10
commit 325eadca9f

View File

@@ -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);