From 58721d3b459f565a5bd1d5eeeeadb3a058f8d18b Mon Sep 17 00:00:00 2001 From: bluhm Date: Fri, 28 Apr 2023 10:18:57 +0000 Subject: [PATCH] Remove error handling around mallocarray(9). I cannot fail when called with M_WAITOK. OK kevlo@ --- sys/dev/pci/if_igc.c | 7 +++---- sys/dev/pci/if_ix.c | 7 +++---- sys/dev/pci/if_oce.c | 7 +++---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/sys/dev/pci/if_igc.c b/sys/dev/pci/if_igc.c index e76ffcbfd1f..db84e23bb68 100644 --- a/sys/dev/pci/if_igc.c +++ b/sys/dev/pci/if_igc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_igc.c,v 1.12 2023/03/09 00:13:47 chris Exp $ */ +/* $OpenBSD: if_igc.c,v 1.13 2023/04/28 10:18:57 bluhm Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause * @@ -1209,9 +1209,8 @@ igc_rxrinfo(struct igc_softc *sc, struct if_rxrinfo *ifri) struct rx_ring *rxr; int error, i, n = 0; - if ((ifr = mallocarray(sc->sc_nqueues, sizeof(*ifr), M_DEVBUF, - M_WAITOK | M_ZERO)) == NULL) - return ENOMEM; + ifr = mallocarray(sc->sc_nqueues, sizeof(*ifr), M_DEVBUF, + M_WAITOK | M_ZERO); for (i = 0; i < sc->sc_nqueues; i++) { rxr = &sc->rx_rings[i]; diff --git a/sys/dev/pci/if_ix.c b/sys/dev/pci/if_ix.c index ab9edd51023..870c3349fb3 100644 --- a/sys/dev/pci/if_ix.c +++ b/sys/dev/pci/if_ix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ix.c,v 1.192 2023/02/06 20:27:44 jan Exp $ */ +/* $OpenBSD: if_ix.c,v 1.193 2023/04/28 10:18:57 bluhm Exp $ */ /****************************************************************************** @@ -640,9 +640,8 @@ ixgbe_rxrinfo(struct ix_softc *sc, struct if_rxrinfo *ifri) u_int n = 0; if (sc->num_queues > 1) { - if ((ifr = mallocarray(sc->num_queues, sizeof(*ifr), M_DEVBUF, - M_WAITOK | M_ZERO)) == NULL) - return (ENOMEM); + ifr = mallocarray(sc->num_queues, sizeof(*ifr), M_DEVBUF, + M_WAITOK | M_ZERO); } else ifr = &ifr1; diff --git a/sys/dev/pci/if_oce.c b/sys/dev/pci/if_oce.c index 084fc7af888..2a01f022d94 100644 --- a/sys/dev/pci/if_oce.c +++ b/sys/dev/pci/if_oce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_oce.c,v 1.106 2022/03/11 18:00:48 mpi Exp $ */ +/* $OpenBSD: if_oce.c,v 1.107 2023/04/28 10:18:58 bluhm Exp $ */ /* * Copyright (c) 2012 Mike Belopuhov @@ -902,9 +902,8 @@ oce_rxrinfo(struct oce_softc *sc, struct if_rxrinfo *ifri) u_int n = 0; if (sc->sc_nrq > 1) { - if ((ifr = mallocarray(sc->sc_nrq, sizeof(*ifr), M_DEVBUF, - M_WAITOK | M_ZERO)) == NULL) - return (ENOMEM); + ifr = mallocarray(sc->sc_nrq, sizeof(*ifr), M_DEVBUF, + M_WAITOK | M_ZERO); } else ifr = &ifr1; -- 2.20.1