mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 00:20:32 +00:00
thunderbolt: Do not allow subtracting more NFC credits than configured
This might happen if the boot firmware uses different amount of NFC credits than what the router suggests, or we are dealing with pre-USB4 device. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
This commit is contained in:
parent
1e56c88ade
commit
6cb27a04fb
1 changed files with 3 additions and 0 deletions
|
@ -623,6 +623,9 @@ int tb_port_add_nfc_credits(struct tb_port *port, int credits)
|
|||
return 0;
|
||||
|
||||
nfc_credits = port->config.nfc_credits & ADP_CS_4_NFC_BUFFERS_MASK;
|
||||
if (credits < 0)
|
||||
credits = max_t(int, -nfc_credits, credits);
|
||||
|
||||
nfc_credits += credits;
|
||||
|
||||
tb_port_dbg(port, "adding %d NFC credits to %lu", credits,
|
||||
|
|
Loading…
Reference in a new issue