From nobody Mon Sep 30 05:08:23 2024 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XH8Gw4knCz5Xljc; Mon, 30 Sep 2024 05:08:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XH8Gw0SmBz4XBZ; Mon, 30 Sep 2024 05:08:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727672904; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DnMNXBPelpjM5P57rMM0Iy8v9rb6qbavoIa0Se9o1VU=; b=uy/vISjlgj+uGV4ymwOq8nBM6hSWUv6vjUv+VX8qcEAoNz39JPy/uY6b2bPfDlZF1dOoox nPPj/CXJpOTa2Ogj2DlhIe6KpuPerx23Zqar3T+ljy/pnjJqya10hQ73BbYgpKVtp3ybzi 0aalg8kC2JW0ctZMV+PMJcD8LU2CfTkCjyJgqLZPLXPzdYf9Muvq5fX3eKEQa5Fzr1eX8+ 7ToFfLXCi/DXVJWUMspKFvj4bmTtp6bG+8DUaiUuHvsoLRBdmi6b+6ta4etczxm/fPW754 fAtLwk852qObHJHvgWoga/SHwojXvUMNp0L0ZwxQ89kBZBpGW3uWZdreUNttFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727672904; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DnMNXBPelpjM5P57rMM0Iy8v9rb6qbavoIa0Se9o1VU=; b=kfJSIn9TQEfKDLj8dbIV6RyTM4+dS72xzZHadlsltXpf0OSm/gohudWgAmKrJppq2MPScZ jXcWmFwjF12yMQP9IoRwE9bn2Rc31dErEu9+fDjyky/jcRBeZgBSEgK08cmLIagt3T/1nM ui9MiG79z5MTvzV33Jd8zofgITy3p1u/ySstI+DKxqZnt0bo6TakJxOnlep2QYCZo0HsFr 5sZ0CUQHywkx2vSG9OJI9Yq234CiBAESRqFz5pkgTP2f55xyiv3fY0SVh1MAYkWEvRlwZB sEp3PRrWMcdyK5zNvE+tp6E7dAidyh9zhrstaYFarUQfky5XZzDrKPuDKYSmDA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727672904; a=rsa-sha256; cv=none; b=hhM9Cpz48HQUe3g6fkPKX1e9WvS4lphEpwq2u//AAELOeslJzRYtw4JA4TDu27ZD5DKblh OjpHNEQh0jJVd+/wSDw2600QADMHRcQkqYZZJEpwkWqXohMY+8snDIlHolKEVwFgyKhk80 xsFcgNt1cKytRdxq4p3rExWxyU57Iaho4HSEtnaCXvF0sviBCQNmzjtAcZsro8QSDT4Pv0 mlSp/Gk6kqhSsj0gmzZhc61pxJwG50nPMePc4KiHu4r3X2nTYotQOhvpX0ByOlfNMIa4wd Ti5mHioeHfk7gOzURQXHPFGkzukkrbLW8udcOIU2/hHPRAxeubqAlzZEWsanIw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XH8Gw0536zfx7; Mon, 30 Sep 2024 05:08:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48U58NMh025065; Mon, 30 Sep 2024 05:08:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48U58NQk025062; Mon, 30 Sep 2024 05:08:23 GMT (envelope-from git) Date: Mon, 30 Sep 2024 05:08:23 GMT Message-Id: <202409300508.48U58NQk025062@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: f5f9d9d4039d - stable/13 - etherswitch: Stop checking for failures from malloc(M_WAITOK) List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f5f9d9d4039d27e1d1536ffca372dddedbd664d0 Auto-Submitted: auto-generated The branch stable/13 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=f5f9d9d4039d27e1d1536ffca372dddedbd664d0 commit f5f9d9d4039d27e1d1536ffca372dddedbd664d0 Author: Zhenlei Huang AuthorDate: 2024-09-03 10:25:27 +0000 Commit: Zhenlei Huang CommitDate: 2024-09-30 05:05:35 +0000 etherswitch: Stop checking for failures from malloc(M_WAITOK) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45852 (cherry picked from commit 48741f4ceca71523aa1fa8da3bb78b184fad4aca) (cherry picked from commit e78c315e8941ff39d89c45ffa5841b8028a3bbce) --- sys/dev/etherswitch/infineon/adm6996fc.c | 22 ++++------------------ sys/dev/etherswitch/micrel/ksz8995ma.c | 22 ++++------------------ 2 files changed, 8 insertions(+), 36 deletions(-) diff --git a/sys/dev/etherswitch/infineon/adm6996fc.c b/sys/dev/etherswitch/infineon/adm6996fc.c index 39e85270bb70..9acc513a02b7 100644 --- a/sys/dev/etherswitch/infineon/adm6996fc.c +++ b/sys/dev/etherswitch/infineon/adm6996fc.c @@ -185,10 +185,6 @@ adm6996fc_attach_phys(struct adm6996fc_softc *sc) if_initname(sc->ifp[port], name, port); sc->miibus[port] = malloc(sizeof(device_t), M_ADM6996FC, M_WAITOK | M_ZERO); - if (sc->miibus[port] == NULL) { - err = ENOMEM; - goto failed; - } err = mii_attach(sc->sc_dev, sc->miibus[port], sc->ifp[port], adm6996fc_ifmedia_upd, adm6996fc_ifmedia_sts, \ BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0); @@ -261,12 +257,6 @@ adm6996fc_attach(device_t dev) sc->portphy = malloc(sizeof(int) * sc->numports, M_ADM6996FC, M_WAITOK | M_ZERO); - if (sc->ifp == NULL || sc->ifname == NULL || sc->miibus == NULL || - sc->portphy == NULL) { - err = ENOMEM; - goto failed; - } - /* * Attach the PHYs and complete the bus enumeration. */ @@ -287,14 +277,10 @@ adm6996fc_attach(device_t dev) return (0); failed: - if (sc->portphy != NULL) - free(sc->portphy, M_ADM6996FC); - if (sc->miibus != NULL) - free(sc->miibus, M_ADM6996FC); - if (sc->ifname != NULL) - free(sc->ifname, M_ADM6996FC); - if (sc->ifp != NULL) - free(sc->ifp, M_ADM6996FC); + free(sc->portphy, M_ADM6996FC); + free(sc->miibus, M_ADM6996FC); + free(sc->ifname, M_ADM6996FC); + free(sc->ifp, M_ADM6996FC); return (err); } diff --git a/sys/dev/etherswitch/micrel/ksz8995ma.c b/sys/dev/etherswitch/micrel/ksz8995ma.c index 15e03039b5f4..737c3f7a50f3 100644 --- a/sys/dev/etherswitch/micrel/ksz8995ma.c +++ b/sys/dev/etherswitch/micrel/ksz8995ma.c @@ -231,10 +231,6 @@ ksz8995ma_attach_phys(struct ksz8995ma_softc *sc) if_initname(sc->ifp[port], name, port); sc->miibus[port] = malloc(sizeof(device_t), M_KSZ8995MA, M_WAITOK | M_ZERO); - if (sc->miibus[port] == NULL) { - err = ENOMEM; - goto failed; - } err = mii_attach(sc->sc_dev, sc->miibus[port], sc->ifp[port], ksz8995ma_ifmedia_upd, ksz8995ma_ifmedia_sts, \ BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0); @@ -311,12 +307,6 @@ ksz8995ma_attach(device_t dev) sc->portphy = malloc(sizeof(int) * sc->numports, M_KSZ8995MA, M_WAITOK | M_ZERO); - if (sc->ifp == NULL || sc->ifname == NULL || sc->miibus == NULL || - sc->portphy == NULL) { - err = ENOMEM; - goto failed; - } - /* * Attach the PHYs and complete the bus enumeration. */ @@ -345,14 +335,10 @@ ksz8995ma_attach(device_t dev) return (0); failed: - if (sc->portphy != NULL) - free(sc->portphy, M_KSZ8995MA); - if (sc->miibus != NULL) - free(sc->miibus, M_KSZ8995MA); - if (sc->ifname != NULL) - free(sc->ifname, M_KSZ8995MA); - if (sc->ifp != NULL) - free(sc->ifp, M_KSZ8995MA); + free(sc->portphy, M_KSZ8995MA); + free(sc->miibus, M_KSZ8995MA); + free(sc->ifname, M_KSZ8995MA); + free(sc->ifp, M_KSZ8995MA); return (err); }