瀏覽代碼

Merge tag 'hwspinlock-3.6-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/hwspinlock

Pull hwspinlock fix from Ohad Ben-Cohen:
 "A single hwspinlock fix by Wei Yongjun, which prevents potential NULL
  dereferences"

* tag 'hwspinlock-3.6-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/hwspinlock:
  hwspinlock/core: move the dereference below the NULL test
Linus Torvalds 12 年之前
父節點
當前提交
925a6f0bf8
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      drivers/hwspinlock/hwspinlock_core.c

+ 2 - 1
drivers/hwspinlock/hwspinlock_core.c

@@ -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)
 		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 */