xen/events: fix build
authorJuergen Gross <jgross@suse.com>
Wed, 11 Nov 2020 07:56:21 +0000 (08:56 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 11 Nov 2020 07:56:21 +0000 (08:56 +0100)
Commit 5f2df45ead7c1195 ("xen/evtchn: rework per event channel lock")
introduced a build failure for NDEBUG builds.

Fixes: 5f2df45ead7c1195 ("xen/evtchn: rework per event channel lock")
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
xen/common/event_channel.c

index eacd96b92ffa70d51f37b5c20ea97d74c7ca2721..54b2e2550e93fd245788af9b289479b9bfb02075 100644 (file)
@@ -61,13 +61,24 @@ static inline void evtchn_write_lock(struct evtchn *evtchn)
 {
     write_lock(&evtchn->lock);
 
+#ifndef NDEBUG
     evtchn->old_state = evtchn->state;
+#endif
+}
+
+static inline unsigned int old_state(const struct evtchn *evtchn)
+{
+#ifndef NDEBUG
+    return evtchn->old_state;
+#else
+    return ECS_RESERVED; /* Just to allow things to build. */
+#endif
 }
 
 static inline void evtchn_write_unlock(struct evtchn *evtchn)
 {
     /* Enforce lock discipline. */
-    ASSERT(evtchn->old_state == ECS_FREE || evtchn->old_state == ECS_UNBOUND ||
+    ASSERT(old_state(evtchn) == ECS_FREE || old_state(evtchn) == ECS_UNBOUND ||
            evtchn->state == ECS_FREE || evtchn->state == ECS_UNBOUND);
 
     write_unlock(&evtchn->lock);