From: yasuoka Date: Sun, 11 Sep 2022 08:38:39 +0000 (+0000) Subject: Handle if pci_intr_establish() failed. This actually happens if many X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b8b3f978dc6e850a7580cdc7b27367852894c5d7;p=openbsd Handle if pci_intr_establish() failed. This actually happens if many VMXNET3 are configured. from IIJ. ok jmatthew --- diff --git a/sys/dev/pci/if_vmx.c b/sys/dev/pci/if_vmx.c index 3681e1d9b14..0ce506d5542 100644 --- a/sys/dev/pci/if_vmx.c +++ b/sys/dev/pci/if_vmx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vmx.c,v 1.69 2022/03/11 18:00:50 mpi Exp $ */ +/* $OpenBSD: if_vmx.c,v 1.70 2022/09/11 08:38:39 yasuoka Exp $ */ /* * Copyright (c) 2013 Tsubai Masanari @@ -299,9 +299,16 @@ vmxnet3_attach(struct device *parent, struct device *self, void *aux) printf(": failed to map interrupt\n"); return; } + intrstr = pci_intr_string(pa->pa_pc, ih); sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_NET | IPL_MPSAFE, isr, sc, self->dv_xname); - intrstr = pci_intr_string(pa->pa_pc, ih); + if (sc->sc_ih == NULL) { + printf(": unable to establish interrupt handler"); + if (intrstr != NULL) + printf(" at %s", intrstr); + printf("\n"); + return; + } if (intrstr) printf(": %s", intrstr); @@ -325,6 +332,11 @@ vmxnet3_attach(struct device *parent, struct device *self, void *aux) IPL_NET | IPL_MPSAFE, intrmap_cpu(sc->sc_intrmap, i), vmxnet3_intr_queue, q, q->intrname); + if (q->ih == NULL) { + printf(": unable to establish interrupt %d\n", + vec); + return; + } q->intr = vec; q->sc = sc;