Skip to content

Commit

Permalink
watchdog: 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: Wim Van Sebroeck <wim@iguana.be>
  • Loading branch information
Wei Yongjun authored and Wim Van Sebroeck committed Sep 10, 2012
1 parent 308b135 commit b232a70
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/watchdog/watchdog_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b232a70

Please sign in to comment.