watchdog: 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: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
This commit is contained in:
Wei Yongjun 2012-09-10 12:41:15 +08:00 committed by Wim Van Sebroeck
parent 308b135e4f
commit b232a70a17
1 changed files with 2 additions and 1 deletions

View 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);