Skip to content

Commit c9fdfc7

Browse files
committed
Don't crash on driver without init()
Handle init() like deinit()
1 parent 8a9f44b commit c9fdfc7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/host/usbh.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ bool tuh_rhport_init(uint8_t rhport, const tusb_rhport_init_t* rh_init) {
544544
// Class drivers
545545
for (uint8_t drv_id = 0; drv_id < TOTAL_DRIVER_COUNT; drv_id++) {
546546
usbh_class_driver_t const* driver = get_driver(drv_id);
547-
if (driver != NULL) {
547+
if (driver != NULL && driver->init) {
548548
TU_LOG_USBH("%s init\r\n", driver->name);
549549
driver->init();
550550
}

0 commit comments

Comments
 (0)