USB: More variable scope warnings.

Looks like there are still more, let's see if it complains more about this file.
Codacy.
This commit is contained in:
lightningterror 2022-06-26 19:23:49 +02:00
parent 69dbb2e17c
commit 41bc4832f3
1 changed files with 5 additions and 8 deletions

View File

@ -506,13 +506,10 @@ static int ohci_service_iso_td(OHCIState* ohci, struct ohci_ed* ed,
int pid;
int ret;
int i;
USBEndpoint* ep;
struct ohci_iso_td iso_td;
uint32_t addr;
uint16_t starting_frame;
int16_t relative_frame_number;
int frame_count;
uint32_t start_offset, next_offset;
uint32_t next_offset;
uint32_t start_addr, end_addr;
addr = ed->head & OHCI_DPTR_MASK;
@ -524,8 +521,8 @@ static int ohci_service_iso_td(OHCIState* ohci, struct ohci_ed* ed,
return 1;
}
starting_frame = OHCI_BM(iso_td.flags, TD_SF);
frame_count = OHCI_BM(iso_td.flags, TD_FC);
const uint16_t starting_frame = OHCI_BM(iso_td.flags, TD_SF);
const int frame_count = OHCI_BM(iso_td.flags, TD_FC);
relative_frame_number = USUB(ohci->frame_number, starting_frame);
/*trace_usb_ohci_iso_td_head(
@ -597,7 +594,7 @@ static int ohci_service_iso_td(OHCIState* ohci, struct ohci_ed* ed,
return 1;
}
start_offset = iso_td.offset[relative_frame_number];
const uint32_t start_offset = iso_td.offset[relative_frame_number];
if (relative_frame_number < frame_count)
{
next_offset = iso_td.offset[relative_frame_number + 1];
@ -691,7 +688,7 @@ static int ohci_service_iso_td(OHCIState* ohci, struct ohci_ed* ed,
//trace_usb_ohci_td_dev_error();
return 1;
}
ep = usb_ep_get(dev, pid, OHCI_BM(ed->flags, ED_EN));
USBEndpoint* ep = usb_ep_get(dev, pid, OHCI_BM(ed->flags, ED_EN));
usb_packet_setup(&ohci->usb_packet, pid, ep, 0, addr, false, int_req);
usb_packet_addbuf(&ohci->usb_packet, ohci->usb_buf, len);
usb_handle_packet(dev, &ohci->usb_packet);