viadrmums: Stop gracefully at the end of the PCI id list.

This commit is contained in:
riastradh 2020-07-20 21:29:38 +00:00
parent 54377a3dde
commit 0a5240447d
1 changed files with 5 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: via_pci.c,v 1.3 2018/08/27 14:12:44 riastradh Exp $ */ /* $NetBSD: via_pci.c,v 1.4 2020/07/20 21:29:38 riastradh Exp $ */
/*- /*-
* Copyright (c) 2015 The NetBSD Foundation, Inc. * Copyright (c) 2015 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: via_pci.c,v 1.3 2018/08/27 14:12:44 riastradh Exp $"); __KERNEL_RCSID(0, "$NetBSD: via_pci.c,v 1.4 2020/07/20 21:29:38 riastradh Exp $");
#include <sys/types.h> #include <sys/types.h>
#include <sys/device.h> #include <sys/device.h>
@ -70,6 +70,9 @@ viadrm_lookup(const struct pci_attach_args *pa)
unsigned i; unsigned i;
for (i = 0; i < __arraycount(viadrm_pci_ids); i++) { for (i = 0; i < __arraycount(viadrm_pci_ids); i++) {
if (viadrm_pci_ids[i].vendor == 0 &&
viadrm_pci_ids[i].device == 0)
break;
KASSERT(viadrm_pci_ids[i].subvendor == PCI_ANY_ID); KASSERT(viadrm_pci_ids[i].subvendor == PCI_ANY_ID);
KASSERT(viadrm_pci_ids[i].subdevice == PCI_ANY_ID); KASSERT(viadrm_pci_ids[i].subdevice == PCI_ANY_ID);
KASSERT(viadrm_pci_ids[i].class == 0); KASSERT(viadrm_pci_ids[i].class == 0);