Skip to content

drivers: usb: udc: Added check for NULL ep_cfg#106846

Closed
stites-infineon wants to merge 1 commit intozephyrproject-rtos:mainfrom
stites-infineon:topic/udc-null-checks
Closed

drivers: usb: udc: Added check for NULL ep_cfg#106846
stites-infineon wants to merge 1 commit intozephyrproject-rtos:mainfrom
stites-infineon:topic/udc-null-checks

Conversation

@stites-infineon
Copy link
Copy Markdown
Contributor

This driver assumes endpoints are always initialized. Added NULL checks prior to dereferencing these, plus logging.

See #106845

This driver assumes endpoints are always initialized.  The
testusb sample was only using and initializing some, causing
the remaining ones to remain NULL, leading to a fault.  Added
NULL checks prior to dereferencing these, plus logging.

Signed-off-by: Zayne Stites <Zayne.Stites@infineon.com>
@zephyrbot zephyrbot added the area: USB Universal Serial Bus label Apr 4, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 4, 2026

Comment on lines +839 to +843
if (cfg == NULL) {
LOG_ERR("No ep_cfg for DOUT event");
return -ENODEV;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This driver assumes endpoints are always initialized.

They should be, there must be something else wrong with your quirks/porting.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay, thank you for clarifying. I'll debug my device support update then to see why they aren't. Closing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: USB Universal Serial Bus

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants