rem: while (ofs != 0) { reg_data = read_pci_config(bus, dev, func, ofs, 2);
add: while (maxcount-- != 0 && ofs != 0) {   ofs &= ~3;   reg_data = read_pci_config(bus, dev, func, ofs, 4);
context: static int pci_get_capability(uint8 bus, uint8 dev, uint8 func, uint8 cap,                               uint8 *offs){	uint16 status = read_pci_config(bus, dev, func, PCI_status, 2);	uint8 hdr_type, reg_data;	uint8 ofs;		if (!(status & PCI_status_capabilities))		return 0;			hdr_type = read_pci_config(bus, dev, func, PCI_header_type, 1);	switch(hdr_type) {		case PCI_header_type_generic:			ofs = PCI_capabilities_ptr;			break;		case PCI_header_type_cardbus:			ofs = PCI_capabilities_ptr_2;			break;		default:			return 0;	}		ofs = read_pci_config(bus, dev, func, ofs, 1);	while (ofs != 0) {		reg_data = read_pci_config(bus, dev, func, ofs, 2);		if ((reg_data & 0xff) == cap) {			if (offs)				*offs = ofs;			return 1;		}		ofs = (reg_data >> 8) & 0xff;	}	return 0;}