XHCI: Make sure we have at least one TRB in CreateDescriptorChain.
Linux seems to do the same thing. Confirmed as correct by korli in #12929.
This commit is contained in:
@@ -883,6 +883,9 @@ XHCI::CreateDescriptorChain(size_t bufferSize, int32 &trbCount)
|
|||||||
{
|
{
|
||||||
size_t packetSize = B_PAGE_SIZE * 16;
|
size_t packetSize = B_PAGE_SIZE * 16;
|
||||||
trbCount = (bufferSize + packetSize - 1) / packetSize;
|
trbCount = (bufferSize + packetSize - 1) / packetSize;
|
||||||
|
if (trbCount == 0)
|
||||||
|
trbCount = 1;
|
||||||
|
|
||||||
// keep one trb for linking
|
// keep one trb for linking
|
||||||
int32 tdCount = (trbCount + XHCI_MAX_TRBS_PER_TD - 2)
|
int32 tdCount = (trbCount + XHCI_MAX_TRBS_PER_TD - 2)
|
||||||
/ (XHCI_MAX_TRBS_PER_TD - 1);
|
/ (XHCI_MAX_TRBS_PER_TD - 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user