On Thu, Jan 09, 2020 at 03:43:11PM +0100, Eric Auger wrote: [...]
> +VirtIOIOMMUEndpoint *virtio_iommu_get_endpoint(VirtIOIOMMU *s, uint32_t > ep_id); > +VirtIOIOMMUEndpoint *virtio_iommu_get_endpoint(VirtIOIOMMU *s, uint32_t > ep_id) Is the extra definition trying to workaround the compiler warning/error? I'm not sure whether it's only me who prefer this, but again I'd really perfer we move the function into the caller patch, add "static" as needed altogether, even if that patch can be big. > +{ > + VirtIOIOMMUEndpoint *ep; > + > + ep = g_tree_lookup(s->endpoints, GUINT_TO_POINTER(ep_id)); > + if (ep) { > + return ep; > + } > + if (!virtio_iommu_mr(s, ep_id)) { Could I ask when this will trigger? > + return NULL; > + } > + ep = g_malloc0(sizeof(*ep)); > + ep->id = ep_id; > + trace_virtio_iommu_get_endpoint(ep_id); > + g_tree_insert(s->endpoints, GUINT_TO_POINTER(ep_id), ep); > + return ep; > +} Thanks, -- Peter Xu