Hi Julien, > On 5 Jul 2022, at 4:22 pm, Julien Grall <jul...@xen.org> wrote: > > Hi Jan, > > On 05/07/2022 16:11, Jan Beulich wrote: >> On 22.06.2022 16:38, Rahul Singh wrote: >>> @@ -387,8 +392,19 @@ int evtchn_bind_interdomain(evtchn_bind_interdomain_t >>> *bind) >>> spin_lock(&ld->event_lock); >>> } >>> - if ( (lport = get_free_port(ld)) < 0 ) >>> - ERROR_EXIT(lport); >>> + if ( lport != 0 ) >>> + { >>> + if ( (rc = evtchn_allocate_port(ld, lport)) != 0 ) >>> + ERROR_EXIT_DOM(rc, ld); >>> + } >>> + else >>> + { >>> + int alloc_port = get_free_port(ld); >>> + >>> + if ( alloc_port < 0 ) >>> + ERROR_EXIT_DOM(alloc_port, ld); >>> + lport = alloc_port; >>> + } >> This is then the 3rd instance of this pattern. I think the logic >> wants moving into get_free_port() (perhaps with a name change). > > I think the code below would be suitable. I can send it or Rahul can re-use > the commit [1]:
Thanks for the code. I will include this patch in next version. Regards, Rahul