This is mostly to simplify future logical changes, but it does come with a modest redunction in compiled code size (-55, 345 => 290).
No functional change. Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com> --- CC: Jan Beulich <jbeul...@suse.com> CC: Wei Liu <wei.l...@citrix.com> CC: Roger Pau Monné <roger....@citrix.com> CC: Stefano Stabellini <sstabell...@kernel.org> CC: Julien Grall <julien.gr...@arm.com> CC: George Dunlap <george.dun...@eu.citrix.com> CC: Edwin Török <edvin.to...@citrix.com> CC: Christian Lindig <christian.lin...@citrix.com> CC: Pau Ruiz Safont <pau.saf...@citrix.com> --- xen/common/schedule.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 66f1e26..47f5d04 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -1050,6 +1050,8 @@ static void domain_watchdog_timeout(void *data) static long domain_watchdog(struct domain *d, uint32_t id, uint32_t timeout) { + long rc = 0; + if ( id > NR_DOMAIN_WATCHDOG_TIMERS ) return -EINVAL; @@ -1064,15 +1066,15 @@ static long domain_watchdog(struct domain *d, uint32_t id, uint32_t timeout) set_timer(&d->watchdog_timer[id], NOW() + SECONDS(timeout)); break; } - spin_unlock(&d->watchdog_lock); - return id == NR_DOMAIN_WATCHDOG_TIMERS ? -ENOSPC : id + 1; + rc = id == NR_DOMAIN_WATCHDOG_TIMERS ? -ENOSPC : id + 1; + goto unlock; } id -= 1; if ( !test_bit(id, &d->watchdog_inuse_map) ) { - spin_unlock(&d->watchdog_lock); - return -EINVAL; + rc = -EINVAL; + goto unlock; } if ( timeout == 0 ) @@ -1085,8 +1087,10 @@ static long domain_watchdog(struct domain *d, uint32_t id, uint32_t timeout) set_timer(&d->watchdog_timer[id], NOW() + SECONDS(timeout)); } + unlock: spin_unlock(&d->watchdog_lock); - return 0; + + return rc; } void watchdog_domain_init(struct domain *d) -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel