From nobody Fri Nov 01 14:13:00 2024 X-Original-To: dev-commits-src-all@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 4Xg2rY19sYz5bpbB; Fri, 01 Nov 2024 14:13:01 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xg2rX73Nfz4bNW; Fri, 1 Nov 2024 14:13:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730470381; 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=jqhcruNsZhhexxHG4T05JXWmf94qcAPbBPtrd8WLrec=; b=yez/9t3OJoZlt+DdcxKB0wl3/3eLwv4GvlNDr0cuGTA+V6cdTt1XeyjE2j9cTuvx3Kooey 7UlfPje75N5IX7KSTtYBn5ACul819Q3yocLxNDj9MW/HKIyzMzGJwZGNm/NzNh92GqnIkC ER4CMgX2tWRiXUsYM2oRAklGV82/wJayGceW2O6rHSshoNx3ZOc3QVFZ5DlNnKHWdjgDp9 PuWoW0AkWw4n6SgWxlihGqYmjhhtlRq+cDEuo+5OZsWlLXgdx1L+Ipc/kRtViySJmzM/c0 5JZ3vW5zYBAfUYvqwM9ep/wLa6LhKvrquOWpqHLFitgCW0uzsn9rC9GcqrT7Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730470381; 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=jqhcruNsZhhexxHG4T05JXWmf94qcAPbBPtrd8WLrec=; b=VTfXhcSN8bjXbJzvRGztt4QedGrAoUZf/BQW/89i/gniQ91SkTfN5gZqoXJToNBRw5TAC/ /l2ShXI000eFonljklZwXkTIF0oKfA/WYfFAJ58c3chCs7n7wbsbIlEc90EYkeKs28haHf ORi9RZ1AKGy3JRNw7Yta2cjjMvZYozAcyLXBewP1c7C3XOFjv6VemExGVL78IJCqmQ2U53 sUfay5nemKEJhXP52p4ACA89HXmNpqUZ2WtTAoRpODv3b+6yY/M9de5S4jxpW4KiFetVIq hkZwvRN5weJ8wuBAIsbMXIjzf72wIixOWyb6POic9tozexOoVlxiUYaknfdyCQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730470381; a=rsa-sha256; cv=none; b=W9oBJshFptBAkVStNV43K8Xn3xVi01HliA1y1TtFtxDzAYYekAzcnxCEzbo775iiiikr4F T7IATySPkFq6NUNjSCm9hn+iqjO6H+0BtbaAHLikpN5NKSCESlB/qpmkLPvtTVuIafMhhf 0Js2mkpi9TTN6xN9SgaRpT7gAPYosldpfPFlv9OpXDVujFctD7b4O8SXOVaedtedIsHgjF I4I7vKSY/0izsvw2/OMq8izPaow2gEaCkDyxoRdDTkUzdwY7MY8ZYJ9XCAdhEU1pE2O5oY fSfQDYXLhScPFy8phdHsfGsmcUXYsukd1YB/oBsR89Nxz36GyMlMWl5i+2g9yQ== 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 4Xg2rX6gRLzNpB; Fri, 1 Nov 2024 14:13:00 +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 4A1ED0l5059253; Fri, 1 Nov 2024 14:13:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4A1ED0wu059250; Fri, 1 Nov 2024 14:13:00 GMT (envelope-from git) Date: Fri, 1 Nov 2024 14:13:00 GMT Message-Id: <202411011413.4A1ED0wu059250@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: 5c7af84925aa - main - nvdimm: Use a bus_child_deleted method to free ivars for children List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: 5c7af84925aa0916983551b0d470b461a70c0f1f Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5c7af84925aa0916983551b0d470b461a70c0f1f commit 5c7af84925aa0916983551b0d470b461a70c0f1f Author: John Baldwin AuthorDate: 2024-11-01 14:08:44 +0000 Commit: John Baldwin CommitDate: 2024-11-01 14:08:44 +0000 nvdimm: Use a bus_child_deleted method to free ivars for children Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47363 --- sys/dev/nvdimm/nvdimm_acpi.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/dev/nvdimm/nvdimm_acpi.c b/sys/dev/nvdimm/nvdimm_acpi.c index a8e5db0542f2..f6a7ebe6e2b9 100644 --- a/sys/dev/nvdimm/nvdimm_acpi.c +++ b/sys/dev/nvdimm/nvdimm_acpi.c @@ -197,13 +197,18 @@ nvdimm_root_attach(device_t dev) return (error); } +static void +nvdimm_root_child_deleted(device_t dev, device_t child) +{ + free(device_get_ivars(child), M_NVDIMM_ACPI); +} + static int nvdimm_root_detach(device_t dev) { struct nvdimm_root_dev *root; struct SPA_mapping *spa, *next; - device_t *children; - int i, error, num_children; + int error; root = device_get_softc(dev); SLIST_FOREACH_SAFE(spa, &root->spas, link, next) { @@ -215,12 +220,6 @@ nvdimm_root_detach(device_t dev) error = bus_generic_detach(dev); if (error != 0) return (error); - error = device_get_children(dev, &children, &num_children); - if (error != 0) - return (error); - for (i = 0; i < num_children; i++) - free(device_get_ivars(children[i]), M_NVDIMM_ACPI); - free(children, M_TEMP); error = device_delete_children(dev); return (error); } @@ -264,6 +263,7 @@ static device_method_t nvdimm_acpi_methods[] = { DEVMETHOD(device_attach, nvdimm_root_attach), DEVMETHOD(device_detach, nvdimm_root_detach), DEVMETHOD(bus_add_child, bus_generic_add_child), + DEVMETHOD(bus_child_deleted, nvdimm_root_child_deleted), DEVMETHOD(bus_read_ivar, nvdimm_root_read_ivar), DEVMETHOD(bus_write_ivar, nvdimm_root_write_ivar), DEVMETHOD(bus_child_location, nvdimm_root_child_location),