Bug 259282 - dwc(4) doesn't release resources if phy reset fails
Summary: dwc(4) doesn't release resources if phy reset fails
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-19 18:24 UTC by Nick Reilly
Modified: 2022-05-11 14:34 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Reilly 2021-10-19 18:24:25 UTC
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.
Comment 1 commit-hook freebsd_committer freebsd_triage 2022-02-22 09:02:43 UTC
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(-)
Comment 2 commit-hook freebsd_committer freebsd_triage 2022-03-04 10:29:50 UTC
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(-)