From 97cce2fa58fef84b58808f1861767a4c05dea8e7 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 14 Mar 2014 00:06:43 +0700 Subject: clean up compiler warning transfer of control bypasses initialization --- tinyusb/class/cdc_host.c | 8 ++++++-- tinyusb/class/msc_host.c | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'tinyusb/class') diff --git a/tinyusb/class/cdc_host.c b/tinyusb/class/cdc_host.c index 7bfa30371..771c9a7ae 100644 --- a/tinyusb/class/cdc_host.c +++ b/tinyusb/class/cdc_host.c @@ -156,6 +156,7 @@ void cdch_init(void) tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t const *p_interface_desc, uint16_t *p_length) { OSAL_SUBTASK_BEGIN + // TODO change following assert to subtask_assert if ( CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL != p_interface_desc->bInterfaceSubClass) return TUSB_ERROR_CDC_UNSUPPORTED_SUBCLASS; @@ -165,8 +166,11 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con return TUSB_ERROR_CDC_UNSUPPORTED_PROTOCOL; } - uint8_t const * p_desc = descriptor_next ( (uint8_t const *) p_interface_desc ); - cdch_data_t * p_cdc = &cdch_data[dev_addr-1]; // non-static variable cannot be used after OS service call + uint8_t const * p_desc; + cdch_data_t * p_cdc; + + p_desc = descriptor_next ( (uint8_t const *) p_interface_desc ); + p_cdc = &cdch_data[dev_addr-1]; // non-static variable cannot be used after OS service call p_cdc->interface_number = p_interface_desc->bInterfaceNumber; p_cdc->interface_protocol = p_interface_desc->bInterfaceProtocol; // TODO 0xff is consider as rndis candidate, other is virtual Com diff --git a/tinyusb/class/msc_host.c b/tinyusb/class/msc_host.c index e81bed258..c21bc4ca6 100644 --- a/tinyusb/class/msc_host.c +++ b/tinyusb/class/msc_host.c @@ -306,7 +306,9 @@ tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con } //------------- Open Data Pipe -------------// - tusb_descriptor_endpoint_t const *p_endpoint = (tusb_descriptor_endpoint_t const *) descriptor_next( (uint8_t const*) p_interface_desc ); + tusb_descriptor_endpoint_t const *p_endpoint; + p_endpoint = (tusb_descriptor_endpoint_t const *) descriptor_next( (uint8_t const*) p_interface_desc ); + for(uint32_t i=0; i<2; i++) { SUBTASK_ASSERT(TUSB_DESC_TYPE_ENDPOINT == p_endpoint->bDescriptorType); -- cgit v1.3.1