bugfix: 修正潜在的错误路径 (#64)

* bugfix: 修正潜在的错误路径

* 修正格式
This commit is contained in:
login
2022-10-22 20:17:40 +08:00
committed by GitHub
parent ed178b560b
commit d328bfce6b
20 changed files with 269 additions and 188 deletions

View File

@ -807,7 +807,7 @@ static int xhci_reset_port(const int id, const int port)
io_mfence();
// 重置当前端口
if (XHCI_PORT_IS_USB3(id, port))
xhci_write_op_reg32(id, port_status_offset + XHCI_PORT_PORTSC, (1 << 9) | (1 << 31));
xhci_write_op_reg32(id, port_status_offset + XHCI_PORT_PORTSC, (1 << 9) | (1U << 31));
else
xhci_write_op_reg32(id, port_status_offset + XHCI_PORT_PORTSC, (1 << 9) | (1 << 4));
@ -825,7 +825,7 @@ static int xhci_reset_port(const int id, const int port)
// QEMU对usb的模拟有bug因此需要检测这里
#ifdef __QEMU_EMULATION__
if (XHCI_PORT_IS_USB3(id, port) && (val & (1 << 31)) == 0)
if (XHCI_PORT_IS_USB3(id, port) && (val & (1U << 31)) == 0)
break;
else if (XHCI_PORT_IS_USB2(id, port) && (val & (1 << 4)) == 0)
break;

View File

@ -8,7 +8,7 @@
// ========== irq BEGIN ===========
#define XHCI_IRQ_DONE (1 << 31) // 当command trb 的status的第31位被驱动程序置位时表明该trb已经执行完成这是由于xhci规定第31位可以由驱动程序自行决定用途
#define XHCI_IRQ_DONE (1U << 31) // 当command trb 的status的第31位被驱动程序置位时表明该trb已经执行完成这是由于xhci规定第31位可以由驱动程序自行决定用途
/**
* @brief 每个xhci控制器的中断向量号
*