Skip to content

Commit fe3e5bc

Browse files
committed
Merge tag 'usb-7.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB driver fixes from Greg KH: "Here are some small USB driver fixes for 7.1-rc3 to resolve some reported issues, and a new device id. These are: - usblp driver heap leak fixes - ulpi driver memory leak fix - typec driver fixes - dwc3 driver fix - omap dma driver fix - new option driver device id addition All of these have been in linux-next for over a week with no reported issues" * tag 'usb-7.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: USB: serial: option: add Telit Cinterion LE910Cx compositions usb: usblp: fix uninitialized heap leak via LPGETSTATUS ioctl usb: usblp: fix heap leak in IEEE 1284 device ID via short response usb: dwc3: Move GUID programming after PHY initialization usb: typec: tcpm: fix debug accessory mode detection for sink ports usb: typec: tcpm: reset internal port states on soft reset AMS usb: ulpi: fix memory leak on ulpi_register() error paths USB: omap_udc: DMA: Don't enable burst 4 mode
2 parents 656a95c + 4fd44d4 commit fe3e5bc

6 files changed

Lines changed: 34 additions & 21 deletions

File tree

drivers/usb/class/usblp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ static int usblp_probe(struct usb_interface *intf,
11781178
}
11791179

11801180
/* Allocate buffer for printer status */
1181-
usblp->statusbuf = kmalloc(STATUS_BUF_SIZE, GFP_KERNEL);
1181+
usblp->statusbuf = kzalloc(STATUS_BUF_SIZE, GFP_KERNEL);
11821182
if (!usblp->statusbuf) {
11831183
retval = -ENOMEM;
11841184
goto abort;
@@ -1377,6 +1377,7 @@ static int usblp_cache_device_id_string(struct usblp *usblp)
13771377
{
13781378
int err, length;
13791379

1380+
memset(usblp->device_id_string, 0, USBLP_DEVICE_ID_SIZE);
13801381
err = usblp_get_id(usblp, 0, usblp->device_id_string, USBLP_DEVICE_ID_SIZE - 1);
13811382
if (err < 0) {
13821383
dev_dbg(&usblp->intf->dev,

drivers/usb/common/ulpi.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,15 @@ static int ulpi_register(struct device *dev, struct ulpi *ulpi)
286286
ACPI_COMPANION_SET(&ulpi->dev, ACPI_COMPANION(dev));
287287

288288
ret = ulpi_of_register(ulpi);
289-
if (ret)
289+
if (ret) {
290+
kfree(ulpi);
290291
return ret;
292+
}
291293

292294
ret = ulpi_read_id(ulpi);
293295
if (ret) {
294296
of_node_put(ulpi->dev.of_node);
297+
kfree(ulpi);
295298
return ret;
296299
}
297300

drivers/usb/dwc3/core.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,12 +1359,6 @@ int dwc3_core_init(struct dwc3 *dwc)
13591359

13601360
hw_mode = DWC3_GHWPARAMS0_MODE(dwc->hwparams.hwparams0);
13611361

1362-
/*
1363-
* Write Linux Version Code to our GUID register so it's easy to figure
1364-
* out which kernel version a bug was found.
1365-
*/
1366-
dwc3_writel(dwc, DWC3_GUID, LINUX_VERSION_CODE);
1367-
13681362
ret = dwc3_phy_setup(dwc);
13691363
if (ret)
13701364
return ret;
@@ -1398,6 +1392,12 @@ int dwc3_core_init(struct dwc3 *dwc)
13981392
if (ret)
13991393
goto err_exit_phy;
14001394

1395+
/*
1396+
* Write Linux Version Code to our GUID register so it's easy to figure
1397+
* out which kernel version a bug was found.
1398+
*/
1399+
dwc3_writel(dwc, DWC3_GUID, LINUX_VERSION_CODE);
1400+
14011401
dwc3_core_setup_global_control(dwc);
14021402
dwc3_core_num_eps(dwc);
14031403

drivers/usb/gadget/udc/omap_udc.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,6 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel)
733733
if (status == 0) {
734734
omap_writew(reg, UDC_TXDMA_CFG);
735735
/* EMIFF or SDRC */
736-
omap_set_dma_src_burst_mode(ep->lch,
737-
OMAP_DMA_DATA_BURST_4);
738736
omap_set_dma_src_data_pack(ep->lch, 1);
739737
/* TIPB */
740738
omap_set_dma_dest_params(ep->lch,
@@ -756,8 +754,6 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel)
756754
UDC_DATA_DMA,
757755
0, 0);
758756
/* EMIFF or SDRC */
759-
omap_set_dma_dest_burst_mode(ep->lch,
760-
OMAP_DMA_DATA_BURST_4);
761757
omap_set_dma_dest_data_pack(ep->lch, 1);
762758
}
763759
}

drivers/usb/serial/option.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,7 +1513,11 @@ static const struct usb_device_id option_ids[] = {
15131513
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1231, 0xff), /* Telit LE910Cx (RNDIS) */
15141514
.driver_info = NCTRL(2) | RSVD(3) },
15151515
{ USB_DEVICE_AND_INTERFACE_INFO(TELIT_VENDOR_ID, 0x1250, 0xff, 0x00, 0x00) }, /* Telit LE910Cx (rmnet) */
1516+
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1251, 0xff) }, /* Telit LE910Cx (RNDIS) */
15161517
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1252, 0xff) }, /* Telit LE910Cx (MBIM) */
1518+
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1253, 0xff) }, /* Telit LE910Cx (ECM) */
1519+
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1254, 0xff) }, /* Telit LE910Cx */
1520+
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1255, 0xff) }, /* Telit LE910Cx */
15171521
{ USB_DEVICE(TELIT_VENDOR_ID, 0x1260),
15181522
.driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
15191523
{ USB_DEVICE(TELIT_VENDOR_ID, 0x1261),

drivers/usb/typec/tcpm/tcpm.c

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -732,9 +732,14 @@ static const char * const pd_rev[] = {
732732
(tcpm_cc_is_source((port)->cc2) && \
733733
!tcpm_cc_is_source((port)->cc1)))
734734

735+
#define tcpm_port_is_debug_source(port) \
736+
(tcpm_cc_is_source((port)->cc1) && tcpm_cc_is_source((port)->cc2))
737+
738+
#define tcpm_port_is_debug_sink(port) \
739+
(tcpm_cc_is_sink((port)->cc1) && tcpm_cc_is_sink((port)->cc2))
740+
735741
#define tcpm_port_is_debug(port) \
736-
((tcpm_cc_is_source((port)->cc1) && tcpm_cc_is_source((port)->cc2)) || \
737-
(tcpm_cc_is_sink((port)->cc1) && tcpm_cc_is_sink((port)->cc2)))
742+
(tcpm_port_is_debug_source(port) || tcpm_port_is_debug_sink(port))
738743

739744
#define tcpm_port_is_audio(port) \
740745
(tcpm_cc_is_audio((port)->cc1) && tcpm_cc_is_audio((port)->cc2))
@@ -5176,7 +5181,7 @@ static void run_state_machine(struct tcpm_port *port)
51765181
tcpm_set_state(port, SNK_UNATTACHED, PD_T_DRP_SNK);
51775182
break;
51785183
case SRC_ATTACH_WAIT:
5179-
if (tcpm_port_is_debug(port))
5184+
if (tcpm_port_is_debug_source(port))
51805185
tcpm_set_state(port, DEBUG_ACC_ATTACHED,
51815186
port->timings.cc_debounce_time);
51825187
else if (tcpm_port_is_audio(port))
@@ -5434,7 +5439,7 @@ static void run_state_machine(struct tcpm_port *port)
54345439
tcpm_set_state(port, SRC_UNATTACHED, PD_T_DRP_SRC);
54355440
break;
54365441
case SNK_ATTACH_WAIT:
5437-
if (tcpm_port_is_debug(port))
5442+
if (tcpm_port_is_debug_sink(port))
54385443
tcpm_set_state(port, DEBUG_ACC_ATTACHED,
54395444
PD_T_CC_DEBOUNCE);
54405445
else if (tcpm_port_is_audio(port))
@@ -5454,7 +5459,7 @@ static void run_state_machine(struct tcpm_port *port)
54545459
if (tcpm_port_is_disconnected(port))
54555460
tcpm_set_state(port, SNK_UNATTACHED,
54565461
PD_T_PD_DEBOUNCE);
5457-
else if (tcpm_port_is_debug(port))
5462+
else if (tcpm_port_is_debug_sink(port))
54585463
tcpm_set_state(port, DEBUG_ACC_ATTACHED,
54595464
PD_T_CC_DEBOUNCE);
54605465
else if (tcpm_port_is_audio(port))
@@ -5935,6 +5940,8 @@ static void run_state_machine(struct tcpm_port *port)
59355940
/* remove existing capabilities */
59365941
tcpm_partner_source_caps_reset(port);
59375942
tcpm_pd_send_control(port, PD_CTRL_ACCEPT, TCPC_TX_SOP);
5943+
port->vdm_sm_running = false;
5944+
port->explicit_contract = false;
59385945
tcpm_ams_finish(port);
59395946
if (port->pwr_role == TYPEC_SOURCE) {
59405947
port->upcoming_state = SRC_SEND_CAPABILITIES;
@@ -6360,20 +6367,22 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1,
63606367

63616368
switch (port->state) {
63626369
case TOGGLING:
6363-
if (tcpm_port_is_debug(port) || tcpm_port_is_audio(port) ||
6370+
if (tcpm_port_is_debug_source(port) || tcpm_port_is_audio(port) ||
63646371
tcpm_port_is_source(port))
63656372
tcpm_set_state(port, SRC_ATTACH_WAIT, 0);
6366-
else if (tcpm_port_is_sink(port))
6373+
else if (tcpm_port_is_debug_sink(port) || tcpm_port_is_sink(port))
63676374
tcpm_set_state(port, SNK_ATTACH_WAIT, 0);
63686375
break;
63696376
case CHECK_CONTAMINANT:
63706377
/* Wait for Toggling to be resumed */
63716378
break;
63726379
case SRC_UNATTACHED:
63736380
case ACC_UNATTACHED:
6374-
if (tcpm_port_is_debug(port) || tcpm_port_is_audio(port) ||
6381+
if (tcpm_port_is_debug_source(port) || tcpm_port_is_audio(port) ||
63756382
tcpm_port_is_source(port))
63766383
tcpm_set_state(port, SRC_ATTACH_WAIT, 0);
6384+
else if (tcpm_port_is_debug_sink(port))
6385+
tcpm_set_state(port, SNK_ATTACH_WAIT, 0);
63776386
break;
63786387
case SRC_ATTACH_WAIT:
63796388
if (tcpm_port_is_disconnected(port) ||
@@ -6395,7 +6404,7 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1,
63956404
}
63966405
break;
63976406
case SNK_UNATTACHED:
6398-
if (tcpm_port_is_debug(port) || tcpm_port_is_audio(port) ||
6407+
if (tcpm_port_is_debug_sink(port) || tcpm_port_is_audio(port) ||
63996408
tcpm_port_is_sink(port))
64006409
tcpm_set_state(port, SNK_ATTACH_WAIT, 0);
64016410
break;

0 commit comments

Comments
 (0)