]> Pileus Git - ~andy/linux/commitdiff
watchdog: move the dereference below the NULL test
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Mon, 10 Sep 2012 04:41:15 +0000 (12:41 +0800)
committerWim Van Sebroeck <wim@iguana.be>
Mon, 10 Sep 2012 15:33:17 +0000 (17:33 +0200)
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: Wim Van Sebroeck <wim@iguana.be>
drivers/watchdog/watchdog_core.c

index 6aa46a90ff028691f97627765f593d864bc885a1..3796434991faa83466c85c8779a072db1278ef33 100644 (file)
@@ -128,11 +128,12 @@ EXPORT_SYMBOL_GPL(watchdog_register_device);
 void watchdog_unregister_device(struct watchdog_device *wdd)
 {
        int ret;
-       int devno = wdd->cdev.dev;
+       int devno;
 
        if (wdd == NULL)
                return;
 
+       devno = wdd->cdev.dev;
        ret = watchdog_dev_unregister(wdd);
        if (ret)
                pr_err("error unregistering /dev/watchdog (err=%d)\n", ret);