Re: [PATCH kvm-unit-tests v6 11/14] pci: edu: introduce pci-edu helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Nov 27, 2016 at 11:33:19AM +0100, Alexander Gordeev wrote:
> On Wed, Nov 23, 2016 at 06:57:31PM +0800, Peter Xu wrote:
> > +bool edu_init(struct pci_edu_dev *dev)
> > +{
> > +	pcidevaddr_t dev_addr;
> > +
> > +	dev_addr = pci_find_dev(PCI_VENDOR_ID_QEMU, PCI_DEVICE_ID_EDU);
> > +	if (dev_addr == PCIDEVADDR_INVALID)
> > +		return false;
> > +
> > +	pci_dev_init(&dev->pci_dev, dev_addr);
> > +	pci_enable_defaults(&dev->pci_dev);
> > +	assert(edu_check_alive(dev));
> 
> It is rather a question to Andrew.
> Were not you opposed to placing function calls into asserts?

Opposed to code we want without asserts enabled being placed
in asserts. If edu_check_alive is only here for the assert,
then it doesn't matter. If edu_check_alive has some side-effect,
even a printf, then it should be changed to ret = edu_check_alive,
assert(ret). Allowing us to change assert() into a no-op at no
loss of functionality.

Thanks,
drew

> 
> Thanks!
> 
> > +	return true;
> > +}
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux