From nobody Thu Feb 5 21:54:22 2026 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 4f6WG66w9vz6RGsP for ; Thu, 05 Feb 2026 21:54:22 +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 4f6WG61Ltwz3SNF for ; Thu, 05 Feb 2026 21:54:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770328462; 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=ZScbhLEsVTLMAyHMK7rNFSfpP0j1s7nkxdOiyNHUbuQ=; b=xJ5vvxeBkc3UXRQZgH7geZhlI4fTeShSoIj58QtyEdkRjkPovgeoHYIyL2sbPo5omOatZL xTVxqsLMb3CKCsI2WQFDbu4hIkx/zSxSo+bEWvhCZL9pKpuYCVHzrjepKvTi5Y+TBVMbC1 C366CHDAXbFRuGXNOYp6p5dT9CVoUHoLpuDdndUBky5Q5FPY9INlE+5X04cE42Y+MBqkLH +OCSczWup7EhlSWk7f5dNguPV02Qv9VGWTeU841gov43ryviwBWFy6PjUYrxfuRgw3AeoG z4W2/Z/RlTgRn6GRKaJS/XFkCJem/EEKaiiPGOwRqPhdnyDkjZeEMT9sG78DtQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1770328462; a=rsa-sha256; cv=none; b=MPkCu7gVgOwnQx4QR4+30/3SlkrPaOA/8mQWhD0ExuIJ5Wa78TeiVc5G3bsYU1mOExtzsB Ns2CY4YXpx9H8F1i1y8X2wmgFqtRnoKKjZr7ykj/s5kowR9DuFFfckyWdvlnIVSUs/iHpJ GUw9Xh2D4ad6oyr4LGRjT3jWYL/Oun2NWmiSYJnvTf15VuqPaFk2a9HK5fYzIS5T2bhn87 ciqc5vTl76NQgy/FHu52JJgcKw379A6PaTzQJA+l84UnwYt5AsD3LVojwO1Pwx4Oy+yQ+2 xoozpcTBtYxakEhh4d7nrFxEvJIFhIMwkcjn+3DVBinrac0W18myB/gPdMjRFw== 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=1770328462; 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=ZScbhLEsVTLMAyHMK7rNFSfpP0j1s7nkxdOiyNHUbuQ=; b=PuceA3F5xhdPXnWvd7BsDlclC6dcCidrxkEVO9fDdKaWJO/39ulnxrex4nHDZ06Gajj7Kw y1/5FI4b9SPn2ieYTB1bR0fUTfwJnn8OoKXaTfoMoVvczPUTSL6CMx/JnJ8prRYYuOvidb 85Le8XnSZuaemy973CkbjkdQ5HpcqqdiLYeLhbbqqgDKUggaTvHnU4+OZTZ4VGRdRDbRgC 0bDDhYXUDtzr/XIGsTSBaQKwez+wpgk+3m06r6SKQOTA+s4/QOWltShKrD3C0nVFJxKmkV 0pVktlBvx0yhbZ5wT8i2q0MGbIF8lk84thfwga1PZwG6NzQE5XuoEjvs3LCQKg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4f6WG60ymNznh2 for ; Thu, 05 Feb 2026 21:54:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 19882 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 05 Feb 2026 21:54:22 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Marius Strobl Subject: git: 5d546e86517d - stable/14 - sym(4): Provide a DEVICE_DETACH(9) method 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: marius X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 5d546e86517d8052ffb33fccf55f9c5f7438153f Auto-Submitted: auto-generated Date: Thu, 05 Feb 2026 21:54:22 +0000 Message-Id: <6985118e.19882.493994e8@gitrepo.freebsd.org> The branch stable/14 has been updated by marius: URL: https://cgit.FreeBSD.org/src/commit/?id=5d546e86517d8052ffb33fccf55f9c5f7438153f commit 5d546e86517d8052ffb33fccf55f9c5f7438153f Author: Marius Strobl AuthorDate: 2026-01-22 09:05:38 +0000 Commit: Marius Strobl CommitDate: 2026-02-05 21:54:07 +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(); }