From nobody Sun Dec 01 04:57:12 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 4Y1F5P1hhbz5gD2y; Sun, 01 Dec 2024 04:57:13 +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 4Y1F5N2Nvlz49Qv; Sun, 1 Dec 2024 04:57:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733029032; 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=dKZpe5xddoEwYadL6M400zVxoaevUpFFiO7DJxRANz8=; b=O1vlOEvX73AzFth536J9ZQPSf3s5i8ZQY6AAXIX5EueToYCfg3VvRp0ULfEIVFz+RNBxHF 6s2zDx66Tj4cvh8jv5UfolBQzyfWVvAsipDxWTkBGKy1jux+ECZUlmllAshr1VL8oiMRfz p+sOIdoT/+vaX00AWrl+OJFXCQWI04ZPAmRBDxihfJHeON+0klDnazsdXq4cUUAuq012aC m6I7jMe4DiKscO0YOFztoS6pGKAp6Zd23kLbQv4vewq1F+AqA8F1bGIwDGEhlktuTwZg2v QSUG/QHyj7No2e06rLBLmNu4BkOZxofMNe5MMc3RODJni1mQCqAcFv/E0zqzOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733029032; 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=dKZpe5xddoEwYadL6M400zVxoaevUpFFiO7DJxRANz8=; b=MsXAx8clDzBjwep9/lvsUm1gkALu4n3wSNAr42UZgfvFwM/poyPjAZmYNDfpzxGmmFePnO pcqI4/2th7cOOnorhqvhv0gqphFZZ2+VL/aIPl3D3X7ecbd8K3YIgThxZapSHfSj1KGz/3 IPXDpfSqfk6rSqlnK5LEWKdq49KHqn69gpQ8Xy2SFfNVoXbcpca821kK1oWT14D2bzEyND 2jLWFynSAqpsathz5HhMfggQnaf797fe5lfbTbn+H2ea6rm9PiKdDRPKo8COP4qYRpo9xs QVljf3KJFJG7+14BTlSTrb7oWTbfK8TV4CH/OCxCVw8O8TCI11frVdpwD6iL6Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733029032; a=rsa-sha256; cv=none; b=fEgojHNt1fHTbiOt9ec1nro9xrsScMtV4BLNQaiIL2mth43dHwYr03fs52jvXSuO6KDyVA 3Za/EZZ1Ixh1Ag6FpzUqVBHttcLyS4/kjnP5mzMmR0wJrCtCj3qtKUWOQv1L2DcuwQxkMa Cd9I68NG1xgaxIEhzqH7REfgMJCh+fnvQRxtE98B9mPUZAYAn/xjqwYyAR3aDO0sEbuT5U YXKN9haGSLOHqup48pa+lfIYNqSyCV+FoH1Kr8CPgzy5VJ5zxxHJVrrDzX3H9iyU6AL1Kx /svy/KKDiUbV37tJYyy92tAhOevXPvblvTrOs/TSADgtK1u8/1et3C/liXfZ3Q== 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 4Y1F5N21G0zfQr; Sun, 1 Dec 2024 04:57:12 +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 4B14vCcX095244; Sun, 1 Dec 2024 04:57:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B14vCfF095241; Sun, 1 Dec 2024 04:57:12 GMT (envelope-from git) Date: Sun, 1 Dec 2024 04:57:12 GMT Message-Id: <202412010457.4B14vCfF095241@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: bfe10b7712a5 - stable/14 - superio: 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/14 X-Git-Reftype: branch X-Git-Commit: bfe10b7712a5c3ab7511f0714c82fb6a022c2450 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=bfe10b7712a5c3ab7511f0714c82fb6a022c2450 commit bfe10b7712a5c3ab7511f0714c82fb6a022c2450 Author: John Baldwin AuthorDate: 2024-11-01 14:09:21 +0000 Commit: John Baldwin CommitDate: 2024-12-01 02:46:06 +0000 superio: Use a bus_child_deleted method to free ivars for children Previously these ivars were leaked. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47367 (cherry picked from commit 2520675d3f0ef9039049fd67481f013b36f250ee) --- sys/dev/superio/superio.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sys/dev/superio/superio.c b/sys/dev/superio/superio.c index ff05d378ce92..b8797d1bab0e 100644 --- a/sys/dev/superio/superio.c +++ b/sys/dev/superio/superio.c @@ -769,6 +769,18 @@ superio_add_child(device_t dev, u_int order, const char *name, int unit) return (child); } +static void +superio_child_deleted(device_t dev, device_t child) +{ + struct superio_devinfo *dinfo; + + dinfo = device_get_ivars(child); + if (dinfo == NULL) + return; + resource_list_free(&dinfo->resources); + free(dinfo, M_DEVBUF); +} + static int superio_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) { @@ -1079,6 +1091,7 @@ static device_method_t superio_methods[] = { DEVMETHOD(device_resume, bus_generic_resume), DEVMETHOD(bus_add_child, superio_add_child), + DEVMETHOD(bus_child_deleted, superio_child_deleted), DEVMETHOD(bus_child_detached, superio_child_detached), DEVMETHOD(bus_child_location, superio_child_location), DEVMETHOD(bus_child_pnpinfo, superio_child_pnp),