From nobody Tue Sep 03 10:27:11 2024 X-Original-To: dev-commits-src-main@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 4WyhdD1hwTz5MkRK; Tue, 03 Sep 2024 10:27:12 +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 4WyhdC6xZNz4skr; Tue, 3 Sep 2024 10:27:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725359232; 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=tyLEp43Yrz1iu7VF5bl3uO4oQGLnh8nIrNUYcXg9stc=; b=uo+GeeAtfG2XaiVeJQAdnH13t539dMpdyuj4r5/rkOS6BKSWb+eJJkGtrY0E1Jd+gGarmr EMxTH/SHPutw8S0UyzriQQVhF9gLOyvNBn7SjDSnr6rVhu6sXNnZ3OiYeO+2FtYygtd0kM y9/rF3L9SaULxkGP2Tf8vJBAojQIx8zKJOmCw2D2UIU6rwT5E4RZ5UNjqBArbrGJc1chzn ayfmE5sFfWdUQdb8+6/T0h1oORSXs0HK//GizYv5Mnx04iGk7mHVvyoQC3D2Sdpju+YO81 DCadZZ+TUkEee2PQzlzEkePcEP+QCG7WmIKYX4/6pbakaoV/Zds9xPsQzc9bnQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725359232; a=rsa-sha256; cv=none; b=mjE94q8D/9+H9S193V421AscybRqMrUHeRrSivbEugEm9HaPQ2pVNOwfNJdMt22Zzzp7Wa eKmZY/hNX5DCZG99VCAylzOlQnEem99Y+Bts/ENTm99jvq62yPTPUark8rTUQpIjXe8T4x WbxdXgUeX6tOBo6h/L9/FVz9oCWgNvNwf65ycEmIkWgCoYvi9YJZ/gU/ztOyNvr/H+k+fJ DErZ/7wOCueseIqeGrzpxKiFGR+cIxrw4l/jwcxD5snROiU4ejceFVGk7IPAaucEHxZVpF BGmTj4J/O9pDfGCKKsOk8axklky3VTyEVqN879DEKSmfiLwBo1yX0uPi7gJwPg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725359232; 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=tyLEp43Yrz1iu7VF5bl3uO4oQGLnh8nIrNUYcXg9stc=; b=fTSovKTMw/+4vi3Z0xtRa2GeRazMArROcTjX9sbgVaPd+9Geo3/e44GvHxudt6s0ggB+H3 b4LAHise8XvfegLnZUfBCmlftOqaZquFKmxgcm7wSUA2fcUO5BBOVYrXUVvVQ/oRa0Y+Jp VrPStcw2kV/EZ9Fk0SyLmZQUX1/z/xlnSZSCWZr71wLJQz9aGbUlepn939CANroUNdUGAu tifvME0QZkk6rHRG6749z2pBjfUIWNwwBoQJpjE5J31Jl/KOb8CGiw2RNtQkiMpRuCaVMP 5pgYPFh61BJpik1W7BX43eDge3FhgZmeET1lNxjCNww7guJkYYTW3IpezqWVdQ== 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 4WyhdC6NfpzcVQ; Tue, 3 Sep 2024 10:27:11 +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 483ARBEc009979; Tue, 3 Sep 2024 10:27:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 483ARB4A009976; Tue, 3 Sep 2024 10:27:11 GMT (envelope-from git) Date: Tue, 3 Sep 2024 10:27:11 GMT Message-Id: <202409031027.483ARB4A009976@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 48741f4ceca7 - main - etherswitch: Stop checking for failures from malloc(M_WAITOK) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 48741f4ceca71523aa1fa8da3bb78b184fad4aca Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=48741f4ceca71523aa1fa8da3bb78b184fad4aca commit 48741f4ceca71523aa1fa8da3bb78b184fad4aca Author: Zhenlei Huang AuthorDate: 2024-09-03 10:25:27 +0000 Commit: Zhenlei Huang CommitDate: 2024-09-03 10:25:27 +0000 etherswitch: Stop checking for failures from malloc(M_WAITOK) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45852 --- 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 2c6c83a4388d..64f61df93db1 100644 --- a/sys/dev/etherswitch/infineon/adm6996fc.c +++ b/sys/dev/etherswitch/infineon/adm6996fc.c @@ -179,10 +179,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); @@ -255,12 +251,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. */ @@ -281,14 +271,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 e512a86202c6..ccd7dbffa9e9 100644 --- a/sys/dev/etherswitch/micrel/ksz8995ma.c +++ b/sys/dev/etherswitch/micrel/ksz8995ma.c @@ -225,10 +225,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); @@ -305,12 +301,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. */ @@ -339,14 +329,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); }