On Mon, Mar 05, 2018 at 04:27:43PM +0800, Peter Xu wrote: > On Thu, Mar 01, 2018 at 06:33:31PM +0800, Liu, Yi L wrote: > > [...] > > > -void pci_setup_iommu(PCIBus *bus, PCIIOMMUFunc fn, void *opaque) > > +void pci_device_notify_iommu(PCIDevice *dev, PCIDevNotifyType type) > > { > > - bus->iommu_fn = fn; > > + PCIBus *bus = PCI_BUS(pci_get_bus(dev)); > > + PCIBus *iommu_bus = bus; > > + > > + while (iommu_bus && !iommu_bus->iommu_fn && iommu_bus->parent_dev) { > > + iommu_bus = PCI_BUS(pci_get_bus(iommu_bus->parent_dev)); > > + } > > + if (iommu_bus && iommu_bus->notify_fn) { > > + iommu_bus->notify_fn(bus, > > + iommu_bus->iommu_opaque, > > + dev->devfn, > > + type); > > We didn't really check the return code for notify function. What if > it failed? If we care, we'd better handle the failure; or we can just > define the notify_fn() to return void (now it's int).
Good catch. I think we need to handle failure. User should be aware of it. I'll try to add accordingly in next version. > > + } > > + return; > > I saw many places in the series that you added explicit return for > "void" return-typed functions. IMHO all of them can be dropped. Thanks for spotting it, would fix them in next version. Regards, Yi Liu