Skip to content

Commit

Permalink
hwspinlock/core: move the dereference below the NULL test
Browse files Browse the repository at this point in the history
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: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
  • Loading branch information
Wei Yongjun authored and Ohad Ben-Cohen committed Sep 10, 2012
1 parent 55d512e commit e352614
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/hwspinlock/hwspinlock_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ EXPORT_SYMBOL_GPL(hwspin_lock_request_specific);
*/
int hwspin_lock_free(struct hwspinlock *hwlock)
{
struct device *dev = hwlock->bank->dev;
struct device *dev;
struct hwspinlock *tmp;
int ret;

Expand All @@ -561,6 +561,7 @@ int hwspin_lock_free(struct hwspinlock *hwlock)
return -EINVAL;
}

dev = hwlock->bank->dev;
mutex_lock(&hwspinlock_tree_lock);

/* make sure the hwspinlock is used */
Expand Down

0 comments on commit e352614

Please sign in to comment.