Commit e352614c authored by Wei Yongjun's avatar Wei Yongjun Committed by Ohad Ben-Cohen

hwspinlock/core: move the dereference below the NULL test

The dereference should be moved below the NULL test.

spatch with a semantic match is used to found this.
(http://coccinelle.lip6.fr/)
Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
parent 55d512e2
...@@ -552,7 +552,7 @@ EXPORT_SYMBOL_GPL(hwspin_lock_request_specific); ...@@ -552,7 +552,7 @@ EXPORT_SYMBOL_GPL(hwspin_lock_request_specific);
*/ */
int hwspin_lock_free(struct hwspinlock *hwlock) int hwspin_lock_free(struct hwspinlock *hwlock)
{ {
struct device *dev = hwlock->bank->dev; struct device *dev;
struct hwspinlock *tmp; struct hwspinlock *tmp;
int ret; int ret;
...@@ -561,6 +561,7 @@ int hwspin_lock_free(struct hwspinlock *hwlock) ...@@ -561,6 +561,7 @@ int hwspin_lock_free(struct hwspinlock *hwlock)
return -EINVAL; return -EINVAL;
} }
dev = hwlock->bank->dev;
mutex_lock(&hwspinlock_tree_lock); mutex_lock(&hwspinlock_tree_lock);
/* make sure the hwspinlock is used */ /* make sure the hwspinlock is used */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment