Skip to content

Commit 3681830

Browse files
committed
Merge tag 'thunderbolt-for-v5.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-linus
Mika writes: thunderbolt: Fixes for v5.10-rc4 This includes two fixes for resource leaks that have been around for a while. Then two fixes for code that was added during v5.10 merge window and PCI IDs for Intel Tiger Lake-H. All these have been in linux-next without reported issues. * tag 'thunderbolt-for-v5.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: thunderbolt: Add support for Intel Tiger Lake-H thunderbolt: Only configure USB4 wake for lane 0 adapters thunderbolt: Add uaccess dependency to debugfs interface thunderbolt: Fix memory leak if ida_simple_get() fails in enumerate_services() thunderbolt: Add the missed ida_simple_remove() in ring_request_msix()
2 parents f8394f2 + f6439c5 commit 3681830

7 files changed

Lines changed: 31 additions & 4 deletions

File tree

drivers/thunderbolt/debugfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <linux/debugfs.h>
1111
#include <linux/pm_runtime.h>
12+
#include <linux/uaccess.h>
1213

1314
#include "tb.h"
1415

drivers/thunderbolt/icm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2284,6 +2284,8 @@ struct tb *icm_probe(struct tb_nhi *nhi)
22842284

22852285
case PCI_DEVICE_ID_INTEL_TGL_NHI0:
22862286
case PCI_DEVICE_ID_INTEL_TGL_NHI1:
2287+
case PCI_DEVICE_ID_INTEL_TGL_H_NHI0:
2288+
case PCI_DEVICE_ID_INTEL_TGL_H_NHI1:
22872289
icm->is_supported = icm_tgl_is_supported;
22882290
icm->driver_ready = icm_icl_driver_ready;
22892291
icm->set_uuid = icm_icl_set_uuid;

drivers/thunderbolt/nhi.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,12 +406,23 @@ static int ring_request_msix(struct tb_ring *ring, bool no_suspend)
406406

407407
ring->vector = ret;
408408

409-
ring->irq = pci_irq_vector(ring->nhi->pdev, ring->vector);
410-
if (ring->irq < 0)
411-
return ring->irq;
409+
ret = pci_irq_vector(ring->nhi->pdev, ring->vector);
410+
if (ret < 0)
411+
goto err_ida_remove;
412+
413+
ring->irq = ret;
412414

413415
irqflags = no_suspend ? IRQF_NO_SUSPEND : 0;
414-
return request_irq(ring->irq, ring_msix, irqflags, "thunderbolt", ring);
416+
ret = request_irq(ring->irq, ring_msix, irqflags, "thunderbolt", ring);
417+
if (ret)
418+
goto err_ida_remove;
419+
420+
return 0;
421+
422+
err_ida_remove:
423+
ida_simple_remove(&nhi->msix_ida, ring->vector);
424+
425+
return ret;
415426
}
416427

417428
static void ring_release_msix(struct tb_ring *ring)
@@ -1334,6 +1345,10 @@ static struct pci_device_id nhi_ids[] = {
13341345
.driver_data = (kernel_ulong_t)&icl_nhi_ops },
13351346
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGL_NHI1),
13361347
.driver_data = (kernel_ulong_t)&icl_nhi_ops },
1348+
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGL_H_NHI0),
1349+
.driver_data = (kernel_ulong_t)&icl_nhi_ops },
1350+
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGL_H_NHI1),
1351+
.driver_data = (kernel_ulong_t)&icl_nhi_ops },
13371352

13381353
/* Any USB4 compliant host */
13391354
{ PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_USB4, ~0) },

drivers/thunderbolt/nhi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ extern const struct tb_nhi_ops icl_nhi_ops;
7575
#define PCI_DEVICE_ID_INTEL_ICL_NHI0 0x8a17
7676
#define PCI_DEVICE_ID_INTEL_TGL_NHI0 0x9a1b
7777
#define PCI_DEVICE_ID_INTEL_TGL_NHI1 0x9a1d
78+
#define PCI_DEVICE_ID_INTEL_TGL_H_NHI0 0x9a1f
79+
#define PCI_DEVICE_ID_INTEL_TGL_H_NHI1 0x9a21
7880

7981
#define PCI_CLASS_SERIAL_USB_USB4 0x0c0340
8082

drivers/thunderbolt/tb.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,8 @@ static inline bool tb_switch_is_tiger_lake(const struct tb_switch *sw)
784784
switch (sw->config.device_id) {
785785
case PCI_DEVICE_ID_INTEL_TGL_NHI0:
786786
case PCI_DEVICE_ID_INTEL_TGL_NHI1:
787+
case PCI_DEVICE_ID_INTEL_TGL_H_NHI0:
788+
case PCI_DEVICE_ID_INTEL_TGL_H_NHI1:
787789
return true;
788790
}
789791
}

drivers/thunderbolt/usb4.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,12 @@ int usb4_switch_set_wake(struct tb_switch *sw, unsigned int flags)
421421
* upstream USB4 port.
422422
*/
423423
tb_switch_for_each_port(sw, port) {
424+
if (!tb_port_is_null(port))
425+
continue;
424426
if (!route && tb_is_upstream_port(port))
425427
continue;
428+
if (!port->cap_usb4)
429+
continue;
426430

427431
ret = tb_port_read(port, &val, TB_CFG_PORT,
428432
port->cap_usb4 + PORT_CS_19, 1);

drivers/thunderbolt/xdomain.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,7 @@ static void enumerate_services(struct tb_xdomain *xd)
881881

882882
id = ida_simple_get(&xd->service_ids, 0, 0, GFP_KERNEL);
883883
if (id < 0) {
884+
kfree(svc->key);
884885
kfree(svc);
885886
break;
886887
}

0 commit comments

Comments
 (0)