diff options
| author | hathach <[email protected]> | 2014-03-14 00:06:43 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2014-03-14 00:06:43 +0700 |
| commit | 97cce2fa58fef84b58808f1861767a4c05dea8e7 (patch) | |
| tree | fc0db25b495d727a52d101624ea391e95565e451 | |
| parent | 2502be94f7a35801ad6ff4570e5b1c949d024c75 (diff) | |
clean up compiler warning transfer of control bypasses initialization
| -rw-r--r-- | demos/device/device_os_none/device_os_none.uvopt | 8 | ||||
| -rw-r--r-- | tinyusb/class/cdc_host.c | 8 | ||||
| -rw-r--r-- | tinyusb/class/msc_host.c | 4 | ||||
| -rw-r--r-- | tinyusb/host/hub.c | 16 |
4 files changed, 22 insertions, 14 deletions
diff --git a/demos/device/device_os_none/device_os_none.uvopt b/demos/device/device_os_none/device_os_none.uvopt index ee540d5ec..b186de568 100644 --- a/demos/device/device_os_none/device_os_none.uvopt +++ b/demos/device/device_os_none/device_os_none.uvopt @@ -932,7 +932,7 @@ <Focus>0</Focus> <ColumnNumber>3</ColumnNumber> <tvExpOptDlg>0</tvExpOptDlg> - <TopLine>72</TopLine> + <TopLine>73</TopLine> <CurrentLine>78</CurrentLine> <bDave2>0</bDave2> <PathWithFileName>..\src\main.c</PathWithFileName> @@ -1386,10 +1386,10 @@ <FileType>1</FileType> <tvExp>0</tvExp> <Focus>0</Focus> - <ColumnNumber>5</ColumnNumber> + <ColumnNumber>0</ColumnNumber> <tvExpOptDlg>0</tvExpOptDlg> - <TopLine>229</TopLine> - <CurrentLine>232</CurrentLine> + <TopLine>230</TopLine> + <CurrentLine>248</CurrentLine> <bDave2>0</bDave2> <PathWithFileName>..\..\..\tinyusb\device\usbd.c</PathWithFileName> <FilenameWithoutPath>usbd.c</FilenameWithoutPath> 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);
diff --git a/tinyusb/host/hub.c b/tinyusb/host/hub.c index 72dd184ab..051647018 100644 --- a/tinyusb/host/hub.c +++ b/tinyusb/host/hub.c @@ -95,10 +95,10 @@ tusb_error_t hub_port_clear_feature_subtask(uint8_t hub_addr, uint8_t hub_port, SUBTASK_ASSERT_STATUS( error );
//------------- Check if feature is cleared -------------//
- { // suppres compiler warning transfer of control bypasses initialization
- hub_port_status_response_t * p_port_status = (hub_port_status_response_t *) hub_enum_buffer;
+ hub_port_status_response_t * p_port_status;
+ p_port_status = (hub_port_status_response_t *) hub_enum_buffer;
+
SUBTASK_ASSERT( !BIT_TEST_(p_port_status->status_change.value, feature-16) );
- }
OSAL_SUBTASK_END
}
@@ -129,11 +129,11 @@ tusb_error_t hub_port_reset_subtask(uint8_t hub_addr, uint8_t hub_port) );
SUBTASK_ASSERT_STATUS( error );
- { // suppres compiler warning transfer of control bypasses initialization
- hub_port_status_response_t * p_port_status = (hub_port_status_response_t *) hub_enum_buffer;
+ hub_port_status_response_t * p_port_status;
+ p_port_status = (hub_port_status_response_t *) hub_enum_buffer;
+
SUBTASK_ASSERT ( p_port_status->status_change.reset && p_port_status->status_current.connect_status &&
p_port_status->status_current.port_power && p_port_status->status_current.port_enable);
- }
OSAL_SUBTASK_END
}
@@ -165,7 +165,9 @@ tusb_error_t hub_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t cons if ( p_interface_desc->bInterfaceProtocol > 1 ) return TUSB_ERROR_HUB_FEATURE_NOT_SUPPORTED;
//------------- Open Interrupt Status 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 );
+
SUBTASK_ASSERT(TUSB_DESC_TYPE_ENDPOINT == p_endpoint->bDescriptorType);
SUBTASK_ASSERT(TUSB_XFER_INTERRUPT == p_endpoint->bmAttributes.xfer);
|
