From nobody Fri Nov 01 14:13:05 2024 X-Original-To: dev-commits-src-main@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 4Xg2rd6dlgz5bpmC; Fri, 01 Nov 2024 14:13:05 +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 4Xg2rd4jLjz4bJm; Fri, 1 Nov 2024 14:13:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730470385; 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=0Vul49BE7505hvh6a4RY4cuUz5/wrESlCpNikI22zXs=; b=kiQJgafcimiR/5ocz93mlkAyi2C6a50np6DKevoNAVyPjEuN7q9eZCrfTx9LCPdKgH91c7 TYa5vhzR8vOCkrpic0V5MeQEe4yQT6EUvc7oKEUsWe7rdvteDJOV2HUgcv/GiY9rBU4uy7 YPxrst0Q9e/uvK0p6FDOglrjJUd0c+SW/PKVAQnf2704IvodCisPjJ90K6z2aBBxmWQmwn wS8KsR+PjUW0jxwpET7INF32ISOfjeBrniNsvGJsJSOiCAZRr6517ffIyLCliH31WT79SN My4GQUJXjzdJWACwwpY8QfsV8v9Nss1+DitQQfJJ7djsFR25PSHuVcgBWK+Jiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730470385; 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=0Vul49BE7505hvh6a4RY4cuUz5/wrESlCpNikI22zXs=; b=fi9pyB7ryxjMz+gnYMP16pGXzFpuMknaXVywwaYZyqSAtFEVkmagvEfkFyXtIKXViecg71 wg+yuJBzlrJSRzy3hgXyGlFCbPngfJtpHwjESNb3zd7MAj9UmtekbgbVPQyxhYAac93bbN OS1o1T4to7j8GHWiOtf+nnlJ2oC55yb+26rFfqBLAq4k9bUBk4vDTCinaPb4ktAwXA0g4G kiGrT396MXqirWiiCfyiA7F+IHxJRPOPI/bQj7e7WTtWG3Kwjf2T6Pc4+I44CSMD4FlQeD 011kDsu4Hp1muIzmd7n3WTqbUfhhny3325BFOwrOSDrHMGHsM2gcZqUOmZ9E9w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730470385; a=rsa-sha256; cv=none; b=Kqf+0zKub5KrGQ2rXEFx7rLjF2S9k+wF6RQ6iLKHg2Hq2TXWB7xO3UG9T2sslHH3rchZpZ Hztq+mu/R+PuD5JPqw6/Pz2QIiQh+hyhPmC11X1J492AN/f0hVcq7VqlfiRlpUwO7qgzsr 9qV2Ys7QUz6+pm2e4sIyjvf5jW/I+azRLiZLQQkl8hUeaJ16HzuSqwGAyAt9DgNFOb7tp7 EMTtX5gXUYuTsMrflMi1WHMRE89q4meexBGBpaWRLX9GJtkQDtpcO25GZowCrL4bT1SQDO vP1dBvnqBpT2AE4qJna1qwa+vfYeW5A1vY3skU2hbfw7HO4I32w0zDgEYwwj0A== 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 4Xg2rd3P2bzNpC; Fri, 1 Nov 2024 14:13:05 +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 4A1ED52O059492; Fri, 1 Nov 2024 14:13:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4A1ED5QB059489; Fri, 1 Nov 2024 14:13:05 GMT (envelope-from git) Date: Fri, 1 Nov 2024 14:13:05 GMT Message-Id: <202411011413.4A1ED5QB059489@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: 2520675d3f0e - main - superio: Use a bus_child_deleted method to free ivars for children List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: 2520675d3f0ef9039049fd67481f013b36f250ee Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=2520675d3f0ef9039049fd67481f013b36f250ee commit 2520675d3f0ef9039049fd67481f013b36f250ee Author: John Baldwin AuthorDate: 2024-11-01 14:09:21 +0000 Commit: John Baldwin CommitDate: 2024-11-01 14:09:21 +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 --- 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 960b89c0cdc0..7dbd7d30907a 100644 --- a/sys/dev/superio/superio.c +++ b/sys/dev/superio/superio.c @@ -768,6 +768,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) { @@ -1078,6 +1090,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),