[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPgLHd_Frq8JPUZW9FuzeZ=sQumVkc=HyxwWPLFwHdgDzmx+kg@mail.gmail.com>
Date: Mon, 10 Sep 2012 12:52:02 +0800
From: Wei Yongjun <weiyj.lk@...il.com>
To: ohad@...ery.com
Cc: yongjun_wei@...ndmicro.com.cn, linux-kernel@...r.kernel.org
Subject: [PATCH] hwspinlock/core: move the dereference below the NULL test
From: Wei Yongjun <yongjun_wei@...ndmicro.com.cn>
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@...ndmicro.com.cn>
---
drivers/hwspinlock/hwspinlock_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c
index 1201a15..db713c0 100644
--- a/drivers/hwspinlock/hwspinlock_core.c
+++ b/drivers/hwspinlock/hwspinlock_core.c
@@ -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;
@@ -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 */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists