From nobody Sun Dec 01 04:57:57 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 4Y1F6G15dzz5gD9H; Sun, 01 Dec 2024 04:57:58 +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 4Y1F6F5ZfZz4CsW; Sun, 1 Dec 2024 04:57:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733029077; 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=AiJjz4xPZ/hL2BMiDydAZXRQew8oRhw/p0G03mA5r4s=; b=WCeL5+ZQx/WpeeFBqfuGPkt1XTNE3QtQ6Lyh8YGwfcTCVfzYEUe6Ml6NDvosmnPP4uMLle XzmPXxMHR3hnIJGHeVs97DFn8vn6AVrJ+G7SOimYqTgTWgP78PBlS0Whm3oKi4oSfkvbdp BL2m2WRiRg+7fgf5SmSOABdPTYqacjR2qYueTJ0aSu7oavoeu1vsn+t2ZzVBSnH9/FteXq txg6aE1n14B0xZ8b5MYI9mHQW5S7bK17Threq7Ml9vwOaVoyfPXpwqR8y/hXcbrC3ITWEc KuyBoxl9mgDeaqiJmX7X50HfNyCY9uQ0mh+EJUpNOSn4zFjOOtMA14AKtR9lJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733029077; 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=AiJjz4xPZ/hL2BMiDydAZXRQew8oRhw/p0G03mA5r4s=; b=ETD8fT+eRE5DTLFhWy4MYw84D7TIB9PkbAJlwMuJBZb8f7slZz5IntpFWY07F4ClWsg6bt JmEq8dd6npMtWohl8KoCovRWhrw5VNYzaTsx0SsRV1EmDpe63XqFY4KcGsuUNDGAcqSpr5 97Bpl/TZSgOXdlOPasDhkCRl5M5U1WVf1dkazYunDqt4KK3Jg+nSY/Oc8FTRbbJiESXDX5 IgM1erINN+xM8FKClXEFkVn8TJxSo/ROgU4PqtPe6+HsA1csPBeF+cSNL9Ob+2IH5vdDi9 0wITFAexHiGyoD3Psg8j4RTtaHZRC6+VQk5zEimx9FD/lQlpa0WvTjn9MxJ4nQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733029077; a=rsa-sha256; cv=none; b=AiiwsCuTFohiEbGQNFyC4Axz1gpFS6MwLF7khh+eNMLIup7aexcazkhC1OuO3Pl6WdO0J+ WOIVuhDdMIcf+fN8oTOJUSKMn7ZdjeeeQNDKG1g6wWkbivjXzF4gzxZfX0j00Qrr1vhGSk /Zpdqz1SmgDMwz6RpfRkmNiSwOvFcsxNWnqUHjCZkPUfq0cMA8YwGe1mX+HitzYeXSJVnR 0a5vFG5coBKUEhytJmbCep0UAr1kPgYmVMgd86Pq5VgHf4J4vvPNWirUwqUd59OIHvF5yk bVt81cd5nDPRPHiptcmYIq4lE/9jgELDuycocdOL3TwLRFGQK2jmotazyKW3dw== 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 4Y1F6F5BkYzfLS; Sun, 1 Dec 2024 04:57:57 +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 4B14vvhF097427; Sun, 1 Dec 2024 04:57:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B14vvO9097424; Sun, 1 Dec 2024 04:57:57 GMT (envelope-from git) Date: Sun, 1 Dec 2024 04:57:57 GMT Message-Id: <202412010457.4B14vvO9097424@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 2aeba8972f03 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 2aeba8972f030be6c313c912a0ef7e678d96e82c Auto-Submitted: auto-generated The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=2aeba8972f030be6c313c912a0ef7e678d96e82c commit 2aeba8972f030be6c313c912a0ef7e678d96e82c Author: John Baldwin AuthorDate: 2024-11-01 14:08:44 +0000 Commit: John Baldwin CommitDate: 2024-11-30 21:40:42 +0000 nvdimm: Use a bus_child_deleted method to free ivars for children Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47363 (cherry picked from commit 5c7af84925aa0916983551b0d470b461a70c0f1f) --- 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 6243b68842b8..3ba9e2549d03 100644 --- a/sys/dev/nvdimm/nvdimm_acpi.c +++ b/sys/dev/nvdimm/nvdimm_acpi.c @@ -192,13 +192,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) { @@ -210,12 +215,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); } @@ -265,6 +264,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_str, nvdimm_root_child_location_str),