git: 3fdf587ab02f - main - ath(4): Stop checking for failures from malloc(M_WAITOK)

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Tue, 03 Sep 2024 10:27:03 UTC
The branch main has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=3fdf587ab02f33018bd042094e3d0bd4169352ed

commit 3fdf587ab02f33018bd042094e3d0bd4169352ed
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2024-09-03 10:25:24 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2024-09-03 10:25:24 +0000

    ath(4): Stop checking for failures from malloc(M_WAITOK)
    
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D45852
---
 sys/dev/ath/if_ath_lna_div.c  | 6 ------
 sys/dev/ath/if_ath_pci.c      | 5 -----
 sys/dev/ath/if_ath_spectral.c | 7 -------
 3 files changed, 18 deletions(-)

diff --git a/sys/dev/ath/if_ath_lna_div.c b/sys/dev/ath/if_ath_lna_div.c
index 1b20591fc64e..0755bb667716 100644
--- a/sys/dev/ath/if_ath_lna_div.c
+++ b/sys/dev/ath/if_ath_lna_div.c
@@ -96,12 +96,6 @@ ath_lna_div_attach(struct ath_softc *sc)
 
 	ss = malloc(sizeof(struct if_ath_ant_comb_state),
 	    M_TEMP, M_WAITOK | M_ZERO);
-	if (ss == NULL) {
-		device_printf(sc->sc_dev, "%s: failed to allocate\n",
-		    __func__);
-		/* Don't fail at this point */
-		return (0);
-	}
 
 	/* Fetch the hardware configuration */
 	OS_MEMZERO(&div_ant_conf, sizeof(div_ant_conf));
diff --git a/sys/dev/ath/if_ath_pci.c b/sys/dev/ath/if_ath_pci.c
index 72f0a802aa5f..a242eab7a694 100644
--- a/sys/dev/ath/if_ath_pci.c
+++ b/sys/dev/ath/if_ath_pci.c
@@ -269,11 +269,6 @@ ath_pci_attach(device_t dev)
 		    __func__, fw->data);
 		sc->sc_eepromdata =
 		    malloc(fw->datasize, M_TEMP, M_WAITOK | M_ZERO);
-		if (! sc->sc_eepromdata) {
-			device_printf(dev, "%s: can't malloc eepromdata\n",
-			    __func__);
-			goto bad4;
-		}
 		memcpy(sc->sc_eepromdata, fw->data, fw->datasize);
 		firmware_put(fw, 0);
 	}
diff --git a/sys/dev/ath/if_ath_spectral.c b/sys/dev/ath/if_ath_spectral.c
index 58f21b526e93..951d66605981 100644
--- a/sys/dev/ath/if_ath_spectral.c
+++ b/sys/dev/ath/if_ath_spectral.c
@@ -112,13 +112,6 @@ ath_spectral_attach(struct ath_softc *sc)
 
 	ss = malloc(sizeof(struct ath_spectral_state),
 	    M_TEMP, M_WAITOK | M_ZERO);
-
-	if (ss == NULL) {
-		device_printf(sc->sc_dev, "%s: failed to alloc memory\n",
-		    __func__);
-		return (-ENOMEM);
-	}
-
 	sc->sc_spectral = ss;
 
 	(void) ath_hal_spectral_get_config(sc->sc_ah, &ss->spectral_state);