in svc_watchdog.c [107:145]
int gb_svc_watchdog_create(struct gb_svc *svc)
{
struct gb_svc_watchdog *watchdog;
int retval;
if (svc->watchdog)
return 0;
watchdog = kmalloc(sizeof(*watchdog), GFP_KERNEL);
if (!watchdog)
return -ENOMEM;
watchdog->enabled = false;
watchdog->svc = svc;
INIT_DELAYED_WORK(&watchdog->work, do_work);
svc->watchdog = watchdog;
watchdog->pm_notifier.notifier_call = svc_watchdog_pm_notifier;
retval = register_pm_notifier(&watchdog->pm_notifier);
if (retval) {
dev_err(&svc->dev, "error registering pm notifier(%d)\n",
retval);
goto svc_watchdog_create_err;
}
retval = gb_svc_watchdog_enable(svc);
if (retval) {
dev_err(&svc->dev, "error enabling watchdog (%d)\n", retval);
unregister_pm_notifier(&watchdog->pm_notifier);
goto svc_watchdog_create_err;
}
return retval;
svc_watchdog_create_err:
svc->watchdog = NULL;
kfree(watchdog);
return retval;
}