From nobody Thu Jan 02 18:28:17 2025 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 4YPFZT6nFqz5jnTb; Thu, 02 Jan 2025 18:28:17 +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 4YPFZT68bNz4tkL; Thu, 2 Jan 2025 18:28:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1735842497; 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=ysIv8SKn1jWTrDV+7yMU5OIgVsdCZft0BLhiREDdtX8=; b=Yy/vTfSi7hQEY+mvc2kQ7tt95ccmBBwJPebLjtfs4UKHweh3ywERsPhcjFNHJL1cFYCxPN tyFbpM7V3D6yu1a0crRDcBwVlLHVUuoU0xUGQ8CaYYQ3zeakK9z/qYnSfYMBZa2Xak0lDb 0Kbz6cYlxDG+rKevEnE+17QefdvwdRRB6Ha/vOSqWuNVq9KiDX8qbzTqmORpxZdYG/o2R3 qsaG3bRzdlMGtIGdY5dDWsTFEhlyjt8Dz8SbIhikUy0oo1nXkwbBmTv4wKahQ3k960kFvD g+voKfjlGvLwf+Dkkpg5wY1qlWbVvU2k/JDCRHlzU899N3DyTU9/5s2tLSVATQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1735842497; 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=ysIv8SKn1jWTrDV+7yMU5OIgVsdCZft0BLhiREDdtX8=; b=c4XKRPBia60PUMC+KRsixyxC6Oo1uVEMTrSqpw5iJOLi48t91nETuAgPUnnutz5QjssxRR 9m3citjhA9MDqMFef4/VYBGm/2fJDj6OUjsXW/1tPiRr6+B7r5428vEOeVLyipqWYkm831 5ADT0tz9g+9FUj6JImDoMBxKLQLV9KqwDNVTmtkpYhMmuOyHdftJQ6pjYUhRUBpFy97NLd 8pxowEHNib0ewcYa3YvPlplN1hHolxQkCZM2n7ABjT3NM56p/slTZ4+mq0v8Btr/FhV0I/ oZ5uipIdGO7xl0Lp8zQ761e21YXTeg7eNxlHCSIT7QPk49jjQtBpCURMxve6ng== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1735842497; a=rsa-sha256; cv=none; b=n2dDAsnztrEx6VWY4dud1zSXRj90gxe/166Bf+10tr7C/ceuqnl0uQq+CMTeIkxZw9xi91 f+578rH4Tf2Vf+53Sg4ox8q96tstJEP4o/nJtw2HjND+sEFKT4Q0J5Bz2C65iXJYaCJ5aX zBZGYvhnE/vZE/CJqdXLCrzWtwUbkFad7pQxqo4oqrMkP5A7c8X5mhNSpnU16p4i5WYxT5 fYdmTWh3Xs+fhmXemGrs3uOO8mvBsWrNAkhF4pf4/B/3bSktDY+cnCVtZTtOPtFqA6bC7s SrnNyMTwu5hfARKI1ohYC7yJF4ZVAvzZIA1Jbz6MJqYQ67QzQjwMI3GeownGgA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YPFZT58xCznww; Thu, 02 Jan 2025 18:28:17 +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 502ISHk3066056; Thu, 2 Jan 2025 18:28:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 502ISHT5066053; Thu, 2 Jan 2025 18:28:17 GMT (envelope-from git) Date: Thu, 2 Jan 2025 18:28:17 GMT Message-Id: <202501021828.502ISHT5066053@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 28f5e880e8b2 - main - Use device_delete_children instead of explicit calls to device_delete_child 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28f5e880e8b28d77cf1a4eb6ce2a766d3c5a3926 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=28f5e880e8b28d77cf1a4eb6ce2a766d3c5a3926 commit 28f5e880e8b28d77cf1a4eb6ce2a766d3c5a3926 Author: John Baldwin AuthorDate: 2025-01-02 18:20:21 +0000 Commit: John Baldwin CommitDate: 2025-01-02 18:20:21 +0000 Use device_delete_children instead of explicit calls to device_delete_child This is simpler and more robust in the face of potential double-frees (e.g. if called after bus_generic_detach which will delete devices in a future commit). Reviewed by: manu, imp Differential Revision: https://reviews.freebsd.org/D47958 --- sys/arm/allwinner/aw_mmc.c | 8 +------- sys/arm64/broadcom/genet/if_genet.c | 5 +---- sys/dev/intpm/intpm.c | 3 +-- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/sys/arm/allwinner/aw_mmc.c b/sys/arm/allwinner/aw_mmc.c index 634afdfdfd46..9f61e1560658 100644 --- a/sys/arm/allwinner/aw_mmc.c +++ b/sys/arm/allwinner/aw_mmc.c @@ -482,7 +482,6 @@ static int aw_mmc_detach(device_t dev) { struct aw_mmc_softc *sc; - device_t d; sc = device_get_softc(dev); @@ -494,12 +493,7 @@ aw_mmc_detach(device_t dev) callout_drain(&sc->aw_timeoutc); - AW_MMC_LOCK(sc); - d = sc->child; - sc->child = NULL; - AW_MMC_UNLOCK(sc); - if (d != NULL) - device_delete_child(sc->aw_dev, d); + device_delete_children(sc->aw_dev); aw_mmc_teardown_dma(sc); diff --git a/sys/arm64/broadcom/genet/if_genet.c b/sys/arm64/broadcom/genet/if_genet.c index ccc35fe841df..0602f076b257 100644 --- a/sys/arm64/broadcom/genet/if_genet.c +++ b/sys/arm64/broadcom/genet/if_genet.c @@ -365,10 +365,7 @@ static void gen_destroy(struct gen_softc *sc) { - if (sc->miibus) { /* can't happen */ - device_delete_child(sc->dev, sc->miibus); - sc->miibus = NULL; - } + device_delete_children(sc->dev); bus_teardown_intr(sc->dev, sc->res[_RES_IRQ1], sc->ih); bus_teardown_intr(sc->dev, sc->res[_RES_IRQ2], sc->ih2); gen_bus_dma_teardown(sc); diff --git a/sys/dev/intpm/intpm.c b/sys/dev/intpm/intpm.c index 6fc228ac0cd0..3aa76ff48263 100644 --- a/sys/dev/intpm/intpm.c +++ b/sys/dev/intpm/intpm.c @@ -202,8 +202,7 @@ intsmb_release_resources(device_t dev) { struct intsmb_softc *sc = device_get_softc(dev); - if (sc->smbus) - device_delete_child(dev, sc->smbus); + device_delete_children(dev); if (sc->irq_hand) bus_teardown_intr(dev, sc->irq_res, sc->irq_hand); if (sc->irq_res)