Skip to content

Commit 3455583

Browse files
committed
fix incorrect null-dereference warnings when compiling with gcc7
1 parent bb5dbd2 commit 3455583

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/host/usbh.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ typedef struct {
123123

124124
// Invalid driver ID in itf2drv[] ep2drv[][] mapping
125125
enum { DRVID_INVALID = 0xFFu };
126-
enum { ADDR_INVALID = 0xFFu };
127126
enum { CONTROLLER_INVALID = 0xFFu };
128127

129128
#if CFG_TUSB_DEBUG >= 2
@@ -1434,7 +1433,8 @@ static uint8_t get_new_address(bool is_hub)
14341433
{
14351434
if (!_usbh_devices[idx].connected) return (idx+1);
14361435
}
1437-
return ADDR_INVALID;
1436+
1437+
return 0; // invalid address
14381438
}
14391439

14401440
static bool enum_request_set_addr(void)
@@ -1443,7 +1443,7 @@ static bool enum_request_set_addr(void)
14431443

14441444
// Get new address
14451445
uint8_t const new_addr = get_new_address(desc_device->bDeviceClass == TUSB_CLASS_HUB);
1446-
TU_ASSERT(new_addr != ADDR_INVALID);
1446+
TU_ASSERT(new_addr != 0);
14471447

14481448
TU_LOG2("Set Address = %d\r\n", new_addr);
14491449

0 commit comments

Comments
 (0)