From nobody Thu Feb 5 21:53:19 2026 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 4f6WDv5QvRz6RGK9 for ; Thu, 05 Feb 2026 21:53:19 +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 "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4f6WDv2HT0z3QF6 for ; Thu, 05 Feb 2026 21:53:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770328399; 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=Vk5EUv0wWWYTCGaUxTrd1QmW3YNe/GOU7j5ZjIhl1xA=; b=SwOSuw6hSIDoxnPF63vrWv1a5zQayd5doLtfMLaf26Yvq7HJKr7NvLz7zKNubUq1zM0QDP /mXZXl+DhsHa2pSMlpoqRLKujaP0AyTSoscsTcQcDA8QcPlciaBBcEX86UoDWp2bIof4Vd u/FMB34yx7DhqHcoag2AghjtCqNeA3pkemMcBzEVcSAvIFJzR4G7UG2jDHq6Y32s5wKZdj jnX9Twc4YzvvU95/bo0ZJHRW2tn+nDuYqEn9FPO4Q0zA7cLC5efeIsoWAhB2+zfUNtEe51 /KbEZqVekVA+DWZd0MQ9q7JRMBOuVO2CNvomuQSkNHUCvR6l/6LTGiXYdSI9DQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1770328399; a=rsa-sha256; cv=none; b=EcIqXXvefsgRGEZKOVXXJ/XRcmLzmCroTzj05x+tiYorEZHXUCASX2zexC4eiGtVO6WtLR LsRyiVzWajt3zXFYpmAj+hgtvye7TlWOZU2HAqinI9yj1E4cFxkN7oS8FSZaCPYAbQQz0G oIi4++C9deKzLz0J9V8tFnCUoZawLR7Pd2U5w8OOkq0QtLyVSwqUzt79krR9g7c+d9PmN5 y0AdYAXQAdjBjrCv8Cmz+W/3JuB48i4y8GJ9ae5YHWeuA7ezN2jklARqycTlJBA3S36m9j 7P65QtSctDEgm37E4Z9iUTQAu7ou2F4FZSunyyuu0eTPwXLHXyCDuLWur+UPLA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770328399; 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=Vk5EUv0wWWYTCGaUxTrd1QmW3YNe/GOU7j5ZjIhl1xA=; b=nLplrCdqqAAkygbrlIppDIl8D47NKEaMe96JfyolLPrFYmXglUluQUeaOfdHyOjlCZTSfA 97guVbFUIwISOzlcP/UtUNqmnvcYsyojoH/P1BtfSfH8tsRHp40VpQexiCSEBqvFDwle9N JFCgC82Y5wQFFsuntkgp0LDLBeHdMscgZOY6jRnni3jo3z44YATrB4tGYjKxoP15f9fZqn AvO8ZIsJKHi08x3G48PujUgMC4og8qBvDQ1wTEA82bjBrjl+thIbdEFfjahgqd3PzpvAoV 06jarVMtZmnd2v9jIDyusxsT/aZW8PpmPsIlxP+Ib0xFgT2aH1An+b7v4u4gzg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4f6WDv1Q27znS2 for ; Thu, 05 Feb 2026 21:53:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 192c3 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 05 Feb 2026 21:53:19 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Marius Strobl Subject: git: 56a09f7f8ff9 - stable/15 - sym(4): Provide a DEVICE_DETACH(9) method 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: marius X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 56a09f7f8ff9bea6262ca07eb80800471dd86276 Auto-Submitted: auto-generated Date: Thu, 05 Feb 2026 21:53:19 +0000 Message-Id: <6985114f.192c3.66d335ff@gitrepo.freebsd.org> The branch stable/15 has been updated by marius: URL: https://cgit.FreeBSD.org/src/commit/?id=56a09f7f8ff9bea6262ca07eb80800471dd86276 commit 56a09f7f8ff9bea6262ca07eb80800471dd86276 Author: Marius Strobl AuthorDate: 2026-01-22 09:05:38 +0000 Commit: Marius Strobl CommitDate: 2026-02-05 21:52:33 +0000 sym(4): Provide a DEVICE_DETACH(9) method This also fixes sym_cam_free() to tear things down correctly, i. e. in opposite order of setup, as well as sym_cam_attach() to not free devq and SIM twice in the failure case. (cherry picked from commit 518c01b31e96bbe8353a551885a61e7da6aed5f6) --- sys/dev/sym/sym_hipd.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/sys/dev/sym/sym_hipd.c b/sys/dev/sym/sym_hipd.c index 6b7c0bd355ef..0e51607fb07a 100644 --- a/sys/dev/sym/sym_hipd.c +++ b/sys/dev/sym/sym_hipd.c @@ -2249,10 +2249,11 @@ static void sym_update_dflags(hcb_p np, u_char *flags, struct ccb_trans_settings *cts); static const struct sym_pci_chip *sym_find_pci_chip (device_t dev); -static int sym_pci_probe (device_t dev); -static int sym_pci_attach (device_t dev); -static void sym_pci_free (hcb_p np); +static device_probe_t sym_pci_probe; +static device_attach_t sym_pci_attach; +static device_detach_t sym_pci_detach; + static int sym_cam_attach (hcb_p np); static void sym_cam_free (hcb_p np); @@ -8237,6 +8238,7 @@ sym_update_dflags(hcb_p np, u_char *flags, struct ccb_trans_settings *cts) static device_method_t sym_pci_methods[] = { DEVMETHOD(device_probe, sym_pci_probe), DEVMETHOD(device_attach, sym_pci_attach), + DEVMETHOD(device_detach, sym_pci_detach), DEVMETHOD_END }; @@ -8740,21 +8742,25 @@ sym_pci_attach(device_t dev) */ attach_failed: if (np) - sym_pci_free(np); + sym_pci_detach(dev); return ENXIO; } /* - * Free everything that have been allocated for this device. + * Detach a device by freeing everything that has been allocated for it. */ -static void sym_pci_free(hcb_p np) +static int +sym_pci_detach(device_t dev) { + hcb_p np; SYM_QUEHEAD *qp; ccb_p cp; tcb_p tp; lcb_p lp; int target, lun; + np = device_get_softc(dev); + /* * First free CAM resources. */ @@ -8829,6 +8835,8 @@ static void sym_pci_free(hcb_p np) SYM_LOCK_DESTROY(); device_set_softc(np->device, NULL); sym_mfree_dma(np, sizeof(*np), "HCB"); + + return (0); } /* @@ -8902,11 +8910,6 @@ static int sym_cam_attach(hcb_p np) return 1; fail: - if (sim) - cam_sim_free(sim, FALSE); - if (devq) - cam_simq_free(devq); - SYM_UNLOCK(); sym_cam_free(np); @@ -8929,15 +8932,16 @@ static void sym_cam_free(hcb_p np) SYM_LOCK(); + if (np->path) { + xpt_async(AC_LOST_DEVICE, np->path, NULL); + xpt_free_path(np->path); + np->path = NULL; + } if (np->sim) { xpt_bus_deregister(cam_sim_path(np->sim)); cam_sim_free(np->sim, /*free_devq*/ TRUE); np->sim = NULL; } - if (np->path) { - xpt_free_path(np->path); - np->path = NULL; - } SYM_UNLOCK(); }