From nobody Fri Nov 01 14:13:01 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 4Xg2rZ36pXz5bpgF; Fri, 01 Nov 2024 14:13:02 +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 4Xg2rZ12F9z4bWN; Fri, 1 Nov 2024 14:13:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730470382; 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=fgB/h6R//DUnwCymozdId8VDwYccAUOSB6WEq3lWioI=; b=e6AY1lBXB7gY7LLh/Mg1WQF+iZLz4LFBM4YpHB/N5NnVxJdlXSf/fjCrrwWLQOL1z/ahcP dGpeo8RL9KUCGpZHUWfstsy1uKe1+VN0Mp1mEDeZLw/XiB7wbsd0CIto963ALsdw4qGdF4 Gtn4Nk+8MAUak/lYkY5eBFRsnR4NOPQQo9tZQ/Vb6L0D46XjVmQa7N/dWmTY6wMhrDPgwc hcf/p++TY8KhVIwaTkwddn69XbGiT17C0XXukegai2O4K3vHyPPbt4M7JN9p+PpjQDUWil bRVGpwtAEyB+azvzLZJVzGriSGNvVxOjqlAq6HHCgyEdgvHhRE9VVTTeoiMZxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730470382; 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=fgB/h6R//DUnwCymozdId8VDwYccAUOSB6WEq3lWioI=; b=bP9gbjfFdc+4rB5ufU/wNSgtESfbIhGyiQ1FwdrIewjAE84jZUIo5eElEK+DqE58HJmxoC O3Xx+sF8dW/LQCXMMcTSldiGsDYkJ4njOl9f5w/pZ95V5Ip3sgct0cG9QTN6btzt6EJ5Mn VKstfYleTK4SOk+Ie9fALpahDG/AuGEB6BTk4MqkwlatEUNVl6MislNiF/dCIsX9fBCc8r tZ71PZxzkY9WzeeO+suxRYjMltNV3MlWHmovQYd3j+W9l9n6+N6jHng4NkUTS/NGcbLWJK 5zMXSEBKVedObZUtVm1phzPBJjxUAqGCIe9N3BIfypnQLlwiX3M8tSjVNIcNWg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730470382; a=rsa-sha256; cv=none; b=mcNx1jYBCOtHDh5xZ/Xv3SOYIYYJbJR4DpXjJK9RjRLQjQvlUSPRRFRub/gOTtFofhnmeg NAdxdZO89yVmKaVC1XPCSVBrpZ9bB1G+RGCAxHcHXL4ORdqHvDnQnh+JtW1AnD4inB1Ts4 CckdRcdoPIXfbqrXJKlrTCrpcCKTVRv+AoUtpnBjJH4mZJuBqZXaJ7Br+uy2P8hO0I+Frm xwrHJx2BYdyTDe1kcNwv9Z9Rc7koqHKDlx0WAe2sDLhU/aiNt3jRHe/uv1WXxjq8Vqo6gn /sSrofSXgi6bQfABtSWMwhLaqfcaNrpwWG4Cjx8Tv6iA8yjhm0jlX/684tq/tw== 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 4Xg2rZ0dWRzNX6; Fri, 1 Nov 2024 14:13:02 +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 4A1ED1X7059313; Fri, 1 Nov 2024 14:13:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4A1ED14c059310; Fri, 1 Nov 2024 14:13:01 GMT (envelope-from git) Date: Fri, 1 Nov 2024 14:13:01 GMT Message-Id: <202411011413.4A1ED14c059310@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: 79dfe2b76189 - main - ow: 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: 79dfe2b761891eb3ab1b6a769d4f6adc97335350 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=79dfe2b761891eb3ab1b6a769d4f6adc97335350 commit 79dfe2b761891eb3ab1b6a769d4f6adc97335350 Author: John Baldwin AuthorDate: 2024-11-01 14:08:52 +0000 Commit: John Baldwin CommitDate: 2024-11-01 14:08:52 +0000 ow: Use a bus_child_deleted method to free ivars for children Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47364 --- sys/dev/ow/ow.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/dev/ow/ow.c b/sys/dev/ow/ow.c index 9901e51c289d..6157c9df2939 100644 --- a/sys/dev/ow/ow.c +++ b/sys/dev/ow/ow.c @@ -330,6 +330,12 @@ ow_add_child(device_t dev, romid_t romid) return (0); } +static void +ow_child_deleted(device_t dev, device_t child) +{ + free(device_get_ivars(child), M_OW); +} + static device_t ow_child_by_romid(device_t dev, romid_t romid) { @@ -560,7 +566,6 @@ ow_detach(device_t ndev) { device_t *children, child; int nkid, i; - struct ow_devinfo *di; struct ow_softc *sc; sc = device_get_softc(ndev); @@ -577,8 +582,6 @@ ow_detach(device_t ndev) return ENOMEM; for (i = 0; i < nkid; i++) { child = children[i]; - di = device_get_ivars(child); - free(di, M_OW); device_delete_child(ndev, child); } free(children, M_TEMP); @@ -703,6 +706,7 @@ static device_method_t ow_methods[] = { DEVMETHOD(device_detach, ow_detach), /* Bus interface */ + DEVMETHOD(bus_child_deleted, ow_child_deleted), DEVMETHOD(bus_child_pnpinfo, ow_child_pnpinfo), DEVMETHOD(bus_read_ivar, ow_read_ivar), DEVMETHOD(bus_write_ivar, ow_write_ivar),