if_dwc.c beginning line 1611 in main: if (bus_alloc_resources(dev, dwc_spec, sc->res)) { device_printf(dev, "could not allocate resources\n"); return (ENXIO); } /* Read MAC before reset */ dwc_get_hwaddr(sc, macaddr); /* Reset the PHY if needed */ if (dwc_reset(dev) != 0) { device_printf(dev, "Can't reset the PHY\n"); return (ENXIO); } If the reset of the PHY fails then the resources are not released.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=30f16ad460e2f9631484d04f067d80ee578473bc commit 30f16ad460e2f9631484d04f067d80ee578473bc Author: Emmanuel Vadot <manu@FreeBSD.org> AuthorDate: 2022-02-22 08:53:11 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> CommitDate: 2022-02-22 09:01:54 +0000 dwc: Release resources when attach fails PR: 259282 MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG sys/dev/dwc/if_dwc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=66f5398552a9ba58906f01b6acedab51fc04554d commit 66f5398552a9ba58906f01b6acedab51fc04554d Author: Emmanuel Vadot <manu@FreeBSD.org> AuthorDate: 2022-02-22 08:53:11 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> CommitDate: 2022-03-04 10:29:13 +0000 dwc: Release resources when attach fails PR: 259282 MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG (cherry picked from commit 30f16ad460e2f9631484d04f067d80ee578473bc) sys/dev/dwc/if_dwc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)