Skip to content

Commit 196856d

Browse files
committed
Merge tag 'usb-6.13-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are some small USB driver fixes and new device ids for 6.13-rc7. Included in here are: - usb serial new device ids - typec bugfixes for reported issues - dwc3 driver fixes - chipidea driver fixes - gadget driver fixes - other minor fixes for reported problems. All of these have been in linux-next for a while, with no reported issues" * tag 'usb-6.13-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: USB: serial: option: add Neoway N723-EA support USB: serial: option: add MeiG Smart SRM815 USB: serial: cp210x: add Phoenix Contact UPS Device usb: typec: fix pm usage counter imbalance in ucsi_ccg_sync_control() usb-storage: Add max sectors quirk for Nokia 208 usb: gadget: midi2: Reverse-select at the right place usb: gadget: f_fs: Remove WARN_ON in functionfs_bind USB: core: Disable LPM only for non-suspended ports usb: fix reference leak in usb_new_device() usb: typec: tcpci: fix NULL pointer issue on shared irq case usb: gadget: u_serial: Disable ep before setting port to null to fix the crash caused by port being null usb: chipidea: ci_hdrc_imx: decrement device's refcount in .remove() and in the error path of .probe() usb: typec: ucsi: Set orientation as none when connector is unplugged usb: gadget: configfs: Ignore trailing LF for user strings to cdev USB: usblp: return error when setting unsupported protocol usb: gadget: f_uac2: Fix incorrect setting of bNumEndpoints usb: typec: tcpm/tcpci_maxim: fix error code in max_contaminant_read_resistance_kohm() usb: host: xhci-plat: set skip_phy_initialization if software node has XHCI_SKIP_PHY_INIT property usb: dwc3-am62: Disable autosuspend during remove usb: dwc3: gadget: fix writing NYET threshold
2 parents be54864 + f3149ed commit 196856d

File tree

20 files changed

+84
-41
lines changed

20 files changed

+84
-41
lines changed

drivers/usb/chipidea/ci_hdrc_imx.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -370,25 +370,29 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
370370
data->pinctrl = devm_pinctrl_get(dev);
371371
if (PTR_ERR(data->pinctrl) == -ENODEV)
372372
data->pinctrl = NULL;
373-
else if (IS_ERR(data->pinctrl))
374-
return dev_err_probe(dev, PTR_ERR(data->pinctrl),
373+
else if (IS_ERR(data->pinctrl)) {
374+
ret = dev_err_probe(dev, PTR_ERR(data->pinctrl),
375375
"pinctrl get failed\n");
376+
goto err_put;
377+
}
376378

377379
data->hsic_pad_regulator =
378380
devm_regulator_get_optional(dev, "hsic");
379381
if (PTR_ERR(data->hsic_pad_regulator) == -ENODEV) {
380382
/* no pad regulator is needed */
381383
data->hsic_pad_regulator = NULL;
382-
} else if (IS_ERR(data->hsic_pad_regulator))
383-
return dev_err_probe(dev, PTR_ERR(data->hsic_pad_regulator),
384+
} else if (IS_ERR(data->hsic_pad_regulator)) {
385+
ret = dev_err_probe(dev, PTR_ERR(data->hsic_pad_regulator),
384386
"Get HSIC pad regulator error\n");
387+
goto err_put;
388+
}
385389

386390
if (data->hsic_pad_regulator) {
387391
ret = regulator_enable(data->hsic_pad_regulator);
388392
if (ret) {
389393
dev_err(dev,
390394
"Failed to enable HSIC pad regulator\n");
391-
return ret;
395+
goto err_put;
392396
}
393397
}
394398
}
@@ -402,13 +406,14 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
402406
dev_err(dev,
403407
"pinctrl_hsic_idle lookup failed, err=%ld\n",
404408
PTR_ERR(pinctrl_hsic_idle));
405-
return PTR_ERR(pinctrl_hsic_idle);
409+
ret = PTR_ERR(pinctrl_hsic_idle);
410+
goto err_put;
406411
}
407412

408413
ret = pinctrl_select_state(data->pinctrl, pinctrl_hsic_idle);
409414
if (ret) {
410415
dev_err(dev, "hsic_idle select failed, err=%d\n", ret);
411-
return ret;
416+
goto err_put;
412417
}
413418

414419
data->pinctrl_hsic_active = pinctrl_lookup_state(data->pinctrl,
@@ -417,7 +422,8 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
417422
dev_err(dev,
418423
"pinctrl_hsic_active lookup failed, err=%ld\n",
419424
PTR_ERR(data->pinctrl_hsic_active));
420-
return PTR_ERR(data->pinctrl_hsic_active);
425+
ret = PTR_ERR(data->pinctrl_hsic_active);
426+
goto err_put;
421427
}
422428
}
423429

@@ -527,6 +533,8 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
527533
if (pdata.flags & CI_HDRC_PMQOS)
528534
cpu_latency_qos_remove_request(&data->pm_qos_req);
529535
data->ci_pdev = NULL;
536+
err_put:
537+
put_device(data->usbmisc_data->dev);
530538
return ret;
531539
}
532540

@@ -551,6 +559,7 @@ static void ci_hdrc_imx_remove(struct platform_device *pdev)
551559
if (data->hsic_pad_regulator)
552560
regulator_disable(data->hsic_pad_regulator);
553561
}
562+
put_device(data->usbmisc_data->dev);
554563
}
555564

556565
static void ci_hdrc_imx_shutdown(struct platform_device *pdev)

drivers/usb/class/usblp.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,11 +1337,12 @@ static int usblp_set_protocol(struct usblp *usblp, int protocol)
13371337
if (protocol < USBLP_FIRST_PROTOCOL || protocol > USBLP_LAST_PROTOCOL)
13381338
return -EINVAL;
13391339

1340+
alts = usblp->protocol[protocol].alt_setting;
1341+
if (alts < 0)
1342+
return -EINVAL;
1343+
13401344
/* Don't unnecessarily set the interface if there's a single alt. */
13411345
if (usblp->intf->num_altsetting > 1) {
1342-
alts = usblp->protocol[protocol].alt_setting;
1343-
if (alts < 0)
1344-
return -EINVAL;
13451346
r = usb_set_interface(usblp->dev, usblp->ifnum, alts);
13461347
if (r < 0) {
13471348
printk(KERN_ERR "usblp: can't set desired altsetting %d on interface %d\n",

drivers/usb/core/hub.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2663,13 +2663,13 @@ int usb_new_device(struct usb_device *udev)
26632663
err = sysfs_create_link(&udev->dev.kobj,
26642664
&port_dev->dev.kobj, "port");
26652665
if (err)
2666-
goto fail;
2666+
goto out_del_dev;
26672667

26682668
err = sysfs_create_link(&port_dev->dev.kobj,
26692669
&udev->dev.kobj, "device");
26702670
if (err) {
26712671
sysfs_remove_link(&udev->dev.kobj, "port");
2672-
goto fail;
2672+
goto out_del_dev;
26732673
}
26742674

26752675
if (!test_and_set_bit(port1, hub->child_usage_bits))
@@ -2683,6 +2683,8 @@ int usb_new_device(struct usb_device *udev)
26832683
pm_runtime_put_sync_autosuspend(&udev->dev);
26842684
return err;
26852685

2686+
out_del_dev:
2687+
device_del(&udev->dev);
26862688
fail:
26872689
usb_set_device_state(udev, USB_STATE_NOTATTACHED);
26882690
pm_runtime_disable(&udev->dev);

drivers/usb/core/port.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,10 +453,11 @@ static int usb_port_runtime_suspend(struct device *dev)
453453
static void usb_port_shutdown(struct device *dev)
454454
{
455455
struct usb_port *port_dev = to_usb_port(dev);
456+
struct usb_device *udev = port_dev->child;
456457

457-
if (port_dev->child) {
458-
usb_disable_usb2_hardware_lpm(port_dev->child);
459-
usb_unlocked_disable_lpm(port_dev->child);
458+
if (udev && !udev->port_is_suspended) {
459+
usb_disable_usb2_hardware_lpm(udev);
460+
usb_unlocked_disable_lpm(udev);
460461
}
461462
}
462463

drivers/usb/dwc3/core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@
464464
#define DWC3_DCTL_TRGTULST_SS_INACT (DWC3_DCTL_TRGTULST(6))
465465

466466
/* These apply for core versions 1.94a and later */
467+
#define DWC3_DCTL_NYET_THRES_MASK (0xf << 20)
467468
#define DWC3_DCTL_NYET_THRES(n) (((n) & 0xf) << 20)
468469

469470
#define DWC3_DCTL_KEEP_CONNECT BIT(19)

drivers/usb/dwc3/dwc3-am62.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ static void dwc3_ti_remove(struct platform_device *pdev)
309309

310310
pm_runtime_put_sync(dev);
311311
pm_runtime_disable(dev);
312+
pm_runtime_dont_use_autosuspend(dev);
312313
pm_runtime_set_suspended(dev);
313314
}
314315

drivers/usb/dwc3/gadget.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4195,8 +4195,10 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
41954195
WARN_ONCE(DWC3_VER_IS_PRIOR(DWC3, 240A) && dwc->has_lpm_erratum,
41964196
"LPM Erratum not available on dwc3 revisions < 2.40a\n");
41974197

4198-
if (dwc->has_lpm_erratum && !DWC3_VER_IS_PRIOR(DWC3, 240A))
4198+
if (dwc->has_lpm_erratum && !DWC3_VER_IS_PRIOR(DWC3, 240A)) {
4199+
reg &= ~DWC3_DCTL_NYET_THRES_MASK;
41994200
reg |= DWC3_DCTL_NYET_THRES(dwc->lpm_nyet_threshold);
4201+
}
42004202

42014203
dwc3_gadget_dctl_write_safe(dwc, reg);
42024204
} else {

drivers/usb/gadget/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ config USB_F_MIDI
211211

212212
config USB_F_MIDI2
213213
tristate
214+
select SND_UMP
215+
select SND_UMP_LEGACY_RAWMIDI
214216

215217
config USB_F_HID
216218
tristate
@@ -445,8 +447,6 @@ config USB_CONFIGFS_F_MIDI2
445447
depends on USB_CONFIGFS
446448
depends on SND
447449
select USB_LIBCOMPOSITE
448-
select SND_UMP
449-
select SND_UMP_LEGACY_RAWMIDI
450450
select USB_F_MIDI2
451451
help
452452
The MIDI 2.0 function driver provides the generic emulated

drivers/usb/gadget/configfs.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,11 +827,15 @@ static ssize_t gadget_string_s_store(struct config_item *item, const char *page,
827827
{
828828
struct gadget_string *string = to_gadget_string(item);
829829
int size = min(sizeof(string->string), len + 1);
830+
ssize_t cpy_len;
830831

831832
if (len > USB_MAX_STRING_LEN)
832833
return -EINVAL;
833834

834-
return strscpy(string->string, page, size);
835+
cpy_len = strscpy(string->string, page, size);
836+
if (cpy_len > 0 && string->string[cpy_len - 1] == '\n')
837+
string->string[cpy_len - 1] = 0;
838+
return len;
835839
}
836840
CONFIGFS_ATTR(gadget_string_, s);
837841

drivers/usb/gadget/function/f_fs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2285,7 +2285,7 @@ static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev)
22852285
struct usb_gadget_strings **lang;
22862286
int first_id;
22872287

2288-
if (WARN_ON(ffs->state != FFS_ACTIVE
2288+
if ((ffs->state != FFS_ACTIVE
22892289
|| test_and_set_bit(FFS_FL_BOUND, &ffs->flags)))
22902290
return -EBADFD;
22912291

0 commit comments

Comments
 (0)