From ac5b405c38fd8212141f9797238e7a13e75cccff Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Wed, 20 Mar 2024 22:32:19 +0100 Subject: [PATCH] Attempt at non-null init of print_hcd/print_ep --- system/usbhcd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/system/usbhcd.c b/system/usbhcd.c index 96053d5..f5129fd 100644 --- a/system/usbhcd.c +++ b/system/usbhcd.c @@ -88,8 +88,9 @@ static int num_hcd = 0; static int print_row = 0; static int print_col = 0; -static const usb_hcd_t *print_hcd = NULL; -static usb_ep_t *print_ep = NULL; +static usb_ep_t uninit_ep; +static usb_ep_t *print_ep = &uninit_ep; +static const usb_hcd_t *print_hcd = &hcd_list[0]; //------------------------------------------------------------------------------ // Public Variables @@ -1051,8 +1052,11 @@ bool usb_serial_print(const char *str) { const char *packet = str; + if (print_ep == &uninit_ep) + return false; + // OUT data method not implemented for all controller types yet - if (!print_hcd || !print_hcd->methods->out_data_request) + if (!print_hcd->methods->out_data_request) return false; while (*packet != '\0') {