Skip to content

Commit c875a6c

Browse files
committed
Merge tag 'usb-6.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are some small USB fixes, and bunch of reverts for 6.19-rc3. Included in here are: - reverts of some typec ucsi driver changes that had a lot of regression reports after -rc1. Let's just revert it all for now and it will come back in a way that is better tested. - other typec bugfixes - usb-storage quirk fixups - dwc3 driver fix - other minor USB fixes for reported problems. All of these have passed 0-day testing and individual testing" * tag 'usb-6.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (22 commits) Revert "usb: typec: ucsi: Update UCSI structure to have message in and message out fields" Revert "usb: typec: ucsi: Add support for message out data structure" Revert "usb: typec: ucsi: Enable debugfs for message_out data structure" Revert "usb: typec: ucsi: Add support for SET_PDOS command" Revert "usb: typec: ucsi: Fix null pointer dereference in ucsi_sync_control_common" Revert "usb: typec: ucsi: Get connector status after enable notifications" usb: ohci-nxp: clean up probe error labels usb: gadget: lpc32xx_udc: clean up probe error labels usb: ohci-nxp: fix device leak on probe failure usb: phy: isp1301: fix non-OF device reference imbalance usb: gadget: lpc32xx_udc: fix clock imbalance in error path usb: typec: ucsi: Get connector status after enable notifications usb: usb-storage: Maintain minimal modifications to the bcdDevice range. usb: dwc3: of-simple: fix clock resource leak in dwc3_of_simple_probe usb: typec: ucsi: Fix null pointer dereference in ucsi_sync_control_common USB: lpc32xx_udc: Fix error handling in probe usb: typec: altmodes/displayport: Drop the device reference in dp_altmode_probe() usb: phy: fsl-usb: Fix use-after-free in delayed work during device removal usb: renesas_usbhs: Fix a resource leak in usbhs_pipe_malloc() usb: typec: ucsi: huawei-gaokin: add DRM dependency ...
2 parents 15225b9 + 2220180 commit c875a6c

20 files changed

Lines changed: 130 additions & 207 deletions

File tree

drivers/usb/dwc3/dwc3-of-simple.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,21 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
7070
simple->num_clocks = ret;
7171
ret = clk_bulk_prepare_enable(simple->num_clocks, simple->clks);
7272
if (ret)
73-
goto err_resetc_assert;
73+
goto err_clk_put_all;
7474

7575
ret = of_platform_populate(np, NULL, NULL, dev);
7676
if (ret)
77-
goto err_clk_put;
77+
goto err_clk_disable;
7878

7979
pm_runtime_set_active(dev);
8080
pm_runtime_enable(dev);
8181
pm_runtime_get_sync(dev);
8282

8383
return 0;
8484

85-
err_clk_put:
85+
err_clk_disable:
8686
clk_bulk_disable_unprepare(simple->num_clocks, simple->clks);
87+
err_clk_put_all:
8788
clk_bulk_put_all(simple->num_clocks, simple->clks);
8889

8990
err_resetc_assert:

drivers/usb/dwc3/gadget.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4826,7 +4826,7 @@ void dwc3_gadget_exit(struct dwc3 *dwc)
48264826
if (!dwc->gadget)
48274827
return;
48284828

4829-
dwc3_enable_susphy(dwc, false);
4829+
dwc3_enable_susphy(dwc, true);
48304830
usb_del_gadget(dwc->gadget);
48314831
dwc3_gadget_free_endpoints(dwc);
48324832
usb_put_gadget(dwc->gadget);

drivers/usb/dwc3/host.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ void dwc3_host_exit(struct dwc3 *dwc)
227227
if (dwc->sys_wakeup)
228228
device_init_wakeup(&dwc->xhci->dev, false);
229229

230-
dwc3_enable_susphy(dwc, false);
230+
dwc3_enable_susphy(dwc, true);
231231
platform_device_unregister(dwc->xhci);
232232
dwc->xhci = NULL;
233233
}

drivers/usb/gadget/udc/lpc32xx_udc.c

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3020,7 +3020,7 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
30203020
pdev->dev.dma_mask = &lpc32xx_usbd_dmamask;
30213021
retval = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
30223022
if (retval)
3023-
return retval;
3023+
goto err_put_client;
30243024

30253025
udc->board = &lpc32xx_usbddata;
30263026

@@ -3038,28 +3038,32 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
30383038
/* Get IRQs */
30393039
for (i = 0; i < 4; i++) {
30403040
udc->udp_irq[i] = platform_get_irq(pdev, i);
3041-
if (udc->udp_irq[i] < 0)
3042-
return udc->udp_irq[i];
3041+
if (udc->udp_irq[i] < 0) {
3042+
retval = udc->udp_irq[i];
3043+
goto err_put_client;
3044+
}
30433045
}
30443046

30453047
udc->udp_baseaddr = devm_platform_ioremap_resource(pdev, 0);
30463048
if (IS_ERR(udc->udp_baseaddr)) {
30473049
dev_err(udc->dev, "IO map failure\n");
3048-
return PTR_ERR(udc->udp_baseaddr);
3050+
retval = PTR_ERR(udc->udp_baseaddr);
3051+
goto err_put_client;
30493052
}
30503053

30513054
/* Get USB device clock */
30523055
udc->usb_slv_clk = devm_clk_get(&pdev->dev, NULL);
30533056
if (IS_ERR(udc->usb_slv_clk)) {
30543057
dev_err(udc->dev, "failed to acquire USB device clock\n");
3055-
return PTR_ERR(udc->usb_slv_clk);
3058+
retval = PTR_ERR(udc->usb_slv_clk);
3059+
goto err_put_client;
30563060
}
30573061

30583062
/* Enable USB device clock */
30593063
retval = clk_prepare_enable(udc->usb_slv_clk);
30603064
if (retval < 0) {
30613065
dev_err(udc->dev, "failed to start USB device clock\n");
3062-
return retval;
3066+
goto err_put_client;
30633067
}
30643068

30653069
/* Setup deferred workqueue data */
@@ -3080,7 +3084,7 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
30803084
if (!udc->udca_v_base) {
30813085
dev_err(udc->dev, "error getting UDCA region\n");
30823086
retval = -ENOMEM;
3083-
goto i2c_fail;
3087+
goto err_disable_clk;
30843088
}
30853089
udc->udca_p_base = dma_handle;
30863090
dev_dbg(udc->dev, "DMA buffer(0x%x bytes), P:0x%08x, V:0x%p\n",
@@ -3093,7 +3097,7 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
30933097
if (!udc->dd_cache) {
30943098
dev_err(udc->dev, "error getting DD DMA region\n");
30953099
retval = -ENOMEM;
3096-
goto dma_alloc_fail;
3100+
goto err_free_dma;
30973101
}
30983102

30993103
/* Clear USB peripheral and initialize gadget endpoints */
@@ -3107,22 +3111,22 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
31073111
if (retval < 0) {
31083112
dev_err(udc->dev, "LP request irq %d failed\n",
31093113
udc->udp_irq[IRQ_USB_LP]);
3110-
goto irq_req_fail;
3114+
goto err_destroy_pool;
31113115
}
31123116
retval = devm_request_irq(dev, udc->udp_irq[IRQ_USB_HP],
31133117
lpc32xx_usb_hp_irq, 0, "udc_hp", udc);
31143118
if (retval < 0) {
31153119
dev_err(udc->dev, "HP request irq %d failed\n",
31163120
udc->udp_irq[IRQ_USB_HP]);
3117-
goto irq_req_fail;
3121+
goto err_destroy_pool;
31183122
}
31193123

31203124
retval = devm_request_irq(dev, udc->udp_irq[IRQ_USB_DEVDMA],
31213125
lpc32xx_usb_devdma_irq, 0, "udc_dma", udc);
31223126
if (retval < 0) {
31233127
dev_err(udc->dev, "DEV request irq %d failed\n",
31243128
udc->udp_irq[IRQ_USB_DEVDMA]);
3125-
goto irq_req_fail;
3129+
goto err_destroy_pool;
31263130
}
31273131

31283132
/* The transceiver interrupt is used for VBUS detection and will
@@ -3133,7 +3137,7 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
31333137
if (retval < 0) {
31343138
dev_err(udc->dev, "VBUS request irq %d failed\n",
31353139
udc->udp_irq[IRQ_USB_ATX]);
3136-
goto irq_req_fail;
3140+
goto err_destroy_pool;
31373141
}
31383142

31393143
/* Initialize wait queue */
@@ -3142,7 +3146,7 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
31423146

31433147
retval = usb_add_gadget_udc(dev, &udc->gadget);
31443148
if (retval < 0)
3145-
goto add_gadget_fail;
3149+
goto err_destroy_pool;
31463150

31473151
dev_set_drvdata(dev, udc);
31483152
device_init_wakeup(dev, 1);
@@ -3154,14 +3158,16 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
31543158
dev_info(udc->dev, "%s version %s\n", driver_name, DRIVER_VERSION);
31553159
return 0;
31563160

3157-
add_gadget_fail:
3158-
irq_req_fail:
3161+
err_destroy_pool:
31593162
dma_pool_destroy(udc->dd_cache);
3160-
dma_alloc_fail:
3163+
err_free_dma:
31613164
dma_free_coherent(&pdev->dev, UDCA_BUFF_SIZE,
31623165
udc->udca_v_base, udc->udca_p_base);
3163-
i2c_fail:
3166+
err_disable_clk:
31643167
clk_disable_unprepare(udc->usb_slv_clk);
3168+
err_put_client:
3169+
put_device(&udc->isp1301_i2c_client->dev);
3170+
31653171
dev_err(udc->dev, "%s probe failed, %d\n", driver_name, retval);
31663172

31673173
return retval;
@@ -3190,6 +3196,8 @@ static void lpc32xx_udc_remove(struct platform_device *pdev)
31903196
udc->udca_v_base, udc->udca_p_base);
31913197

31923198
clk_disable_unprepare(udc->usb_slv_clk);
3199+
3200+
put_device(&udc->isp1301_i2c_client->dev);
31933201
}
31943202

31953203
#ifdef CONFIG_PM

drivers/usb/host/ohci-nxp.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,21 +169,21 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
169169

170170
ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
171171
if (ret)
172-
goto fail_disable;
172+
goto err_put_client;
173173

174174
dev_dbg(&pdev->dev, "%s: " DRIVER_DESC " (nxp)\n", hcd_name);
175175
if (usb_disabled()) {
176176
dev_err(&pdev->dev, "USB is disabled\n");
177177
ret = -ENODEV;
178-
goto fail_disable;
178+
goto err_put_client;
179179
}
180180

181181
/* Enable USB host clock */
182182
usb_host_clk = devm_clk_get_enabled(&pdev->dev, NULL);
183183
if (IS_ERR(usb_host_clk)) {
184184
dev_err(&pdev->dev, "failed to acquire and start USB OHCI clock\n");
185185
ret = PTR_ERR(usb_host_clk);
186-
goto fail_disable;
186+
goto err_put_client;
187187
}
188188

189189
isp1301_configure();
@@ -192,21 +192,21 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
192192
if (!hcd) {
193193
dev_err(&pdev->dev, "Failed to allocate HC buffer\n");
194194
ret = -ENOMEM;
195-
goto fail_disable;
195+
goto err_put_client;
196196
}
197197

198198
hcd->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
199199
if (IS_ERR(hcd->regs)) {
200200
ret = PTR_ERR(hcd->regs);
201-
goto fail_resource;
201+
goto err_put_hcd;
202202
}
203203
hcd->rsrc_start = res->start;
204204
hcd->rsrc_len = resource_size(res);
205205

206206
irq = platform_get_irq(pdev, 0);
207207
if (irq < 0) {
208208
ret = -ENXIO;
209-
goto fail_resource;
209+
goto err_put_hcd;
210210
}
211211

212212
ohci_nxp_start_hc();
@@ -220,9 +220,10 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
220220
}
221221

222222
ohci_nxp_stop_hc();
223-
fail_resource:
223+
err_put_hcd:
224224
usb_put_hcd(hcd);
225-
fail_disable:
225+
err_put_client:
226+
put_device(&isp1301_i2c_client->dev);
226227
isp1301_i2c_client = NULL;
227228
return ret;
228229
}
@@ -234,6 +235,7 @@ static void ohci_hcd_nxp_remove(struct platform_device *pdev)
234235
usb_remove_hcd(hcd);
235236
ohci_nxp_stop_hc();
236237
usb_put_hcd(hcd);
238+
put_device(&isp1301_i2c_client->dev);
237239
isp1301_i2c_client = NULL;
238240
}
239241

drivers/usb/host/xhci-dbgtty.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ static void xhci_dbc_tty_unregister_device(struct xhci_dbc *dbc)
554554
* Hang up the TTY. This wakes up any blocked
555555
* writers and causes subsequent writes to fail.
556556
*/
557-
tty_vhangup(port->port.tty);
557+
tty_port_tty_vhangup(&port->port);
558558

559559
tty_unregister_device(dbc_tty_driver, port->minor);
560560
xhci_dbc_tty_exit_port(port);

drivers/usb/phy/phy-fsl-usb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,7 @@ static void fsl_otg_remove(struct platform_device *pdev)
988988
{
989989
struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev);
990990

991+
disable_delayed_work_sync(&fsl_otg_dev->otg_event);
991992
usb_remove_phy(&fsl_otg_dev->phy);
992993
free_irq(fsl_otg_dev->irq, fsl_otg_dev);
993994

drivers/usb/phy/phy-isp1301.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,12 @@ struct i2c_client *isp1301_get_client(struct device_node *node)
149149
return client;
150150

151151
/* non-DT: only one ISP1301 chip supported */
152-
return isp1301_i2c_client;
152+
if (isp1301_i2c_client) {
153+
get_device(&isp1301_i2c_client->dev);
154+
return isp1301_i2c_client;
155+
}
156+
157+
return NULL;
153158
}
154159
EXPORT_SYMBOL_GPL(isp1301_get_client);
155160

drivers/usb/renesas_usbhs/pipe.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,11 +713,13 @@ struct usbhs_pipe *usbhs_pipe_malloc(struct usbhs_priv *priv,
713713
/* make sure pipe is not busy */
714714
ret = usbhsp_pipe_barrier(pipe);
715715
if (ret < 0) {
716+
usbhsp_put_pipe(pipe);
716717
dev_err(dev, "pipe setup failed %d\n", usbhs_pipe_number(pipe));
717718
return NULL;
718719
}
719720

720721
if (usbhsp_setup_pipecfg(pipe, is_host, dir_in, &pipecfg)) {
722+
usbhsp_put_pipe(pipe);
721723
dev_err(dev, "can't setup pipe\n");
722724
return NULL;
723725
}

drivers/usb/storage/unusual_uas.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ UNUSUAL_DEV(0x125f, 0xa94a, 0x0160, 0x0160,
9898
US_FL_NO_ATA_1X),
9999

100100
/* Reported-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> */
101-
UNUSUAL_DEV(0x13fd, 0x3940, 0x0309, 0x0309,
101+
UNUSUAL_DEV(0x13fd, 0x3940, 0x0000, 0x0309,
102102
"Initio Corporation",
103103
"INIC-3069",
104104
USB_SC_DEVICE, USB_PR_DEVICE, NULL,

0 commit comments

Comments
 (0)