Message ID | 20211216092633.1079354-5-acelan.kao@canonical.com |
---|---|
State | Accepted |
Headers | show |
Series | devices on thunderbolt dock are not recognized on adl-p platform | expand |
diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c index 0acb2f3fe2661..f384cda76e862 100644 --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c @@ -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,