From nobody Sun Dec 1 04:57:08 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 4Y1F5K2TBwz5gD87; Sun, 01 Dec 2024 04:57:09 +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 4Y1F5J6ksCz49Dw; Sun, 1 Dec 2024 04:57:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733029028; 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=h9KU4x0oABOojL+/8XxB0D11Janu0lKrhTD4inla59Q=; b=rJqQhe6K3gt9Q4DYRiMN4j8owQof7MWBsSOGjcU/ybqVxzFRKl4RkTBJnalaNnTxscXTFo l1mZB+WNimWU+gbeXFzjC6FoD6xxNT7SXmf07DDjfjsfL6k29iS/Fpk7YLrUlTY4l1tqqB qOTbDO8+3v8uMpkDIE+1odSNXUa+t84ER1VlbBS6BIxIsSraC5OWhF2i0G+E8XaYdb4oVV iFkIAWd7lMJY9N0GBFnAGFOA02ASXLLHPn3vJ2Kv/nQ5ArY2YAEf9Pf3synjA1sddvBnLK kwKIG4OrrO09oeAgtfe0bx4bf8TXf20BJcizGtkXA6fGXg+mJIPithmePrQhLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733029028; 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=h9KU4x0oABOojL+/8XxB0D11Janu0lKrhTD4inla59Q=; b=n/seYHzgH89R8dZYVRArmLTcoX1Q/9ASa6gt+BIivJ0cJrpeRIWPdr2PBNlkb2whjoVKhS H1+S7crO0A/NlHiCIZ+Xpi1v+XdMzpADN+I+Qs0cjhz6Rhw7LHdKQlUgrblFaL4X6Iwrse povN/zr9GdeCKLYPg/G6DciCUIaKFAxX7FqMYej/comlo+SPc15F0tvT2o7ILI+JaEnj3V Cuhd3Q8yW+W3LlYLPgDULHYzb4z/jioBR3os7vZJxPgZ3ccsTS8rfOLh0rIzlm1jN1vPHH PSCeBNN87kQksDqDuxSwmIN7wmaUXOFDdPN7JqOy0YbWGaGcWiVYxNUZox9OmQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733029028; a=rsa-sha256; cv=none; b=vvVdeggu9CccEiwDlm5DnmOcWFsY1uBkOQSjg7StkcF6pkSKowNm8blilkkSOmVh5KFD/v zkwFDaoF7eMYsy+RnF0VWkkwb1uC3vsfOrKtPO6GlvsEl6RmXsrhW4LHT+DNe/TH9o2x3Q PMT6aDNFoltUunEsH8vDADVDcIV5EdCwduAm+KSt7HcpSmBpYNADoMU4ZDqEd4qC/VUjgn PHKsdMlmuHe+taZQbpwU/FL9EW2rSLeu+4vitGHj0T1qDmH04onRFltLNEutUZPEUd/Jkf q8LRv2VeciWFiKGu/8LKhOVPyTV6opMLxykpYdr9iKnZPLBkR9x+9cfDuEvhFQ== 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 4Y1F5J6J87zfJ4; Sun, 1 Dec 2024 04:57:08 +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 4B14v8L9095073; Sun, 1 Dec 2024 04:57:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B14v8NV095070; Sun, 1 Dec 2024 04:57:08 GMT (envelope-from git) Date: Sun, 1 Dec 2024 04:57:08 GMT Message-Id: <202412010457.4B14v8NV095070@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: 02905fab22a3 - stable/14 - nvdimm: Use a bus_child_deleted method to free ivars for children 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 02905fab22a315343909bd13bbb80dd1d0b601b2 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=02905fab22a315343909bd13bbb80dd1d0b601b2 commit 02905fab22a315343909bd13bbb80dd1d0b601b2 Author: John Baldwin AuthorDate: 2024-11-01 14:08:44 +0000 Commit: John Baldwin CommitDate: 2024-12-01 02:46:06 +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 995e60e8b4ee..8a6cbc32ce5c 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),