Skip to content

Commit c7b0c3b

Browse files
committed
Merge tag 'fixes-for-v5.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus
Felipe writes: usb: fixes for v5.0-rc4 Dwc3 got a fix for cases when gadget driver queue an OUT request of length 0; this is a case that has been overlooked for quite some time now. Exynos' dwc3 glue layer got a fix on the error path for those cases where clk_prepare_enable() fails. TI's AM335x PHY driver got a fix for a race condition during probe. This race happened because driver was powering off the PHY only after adding the PHY handle to the framework. The result is that we could fall into a situation where user of the PHY (MUSB) could call phy_init() before phy driver's probe() called phy_poweroff() which would result in a powered off PHY after phy_init() was called. The old net2272 driver got a fix for an erroneous use of bitwise negation. * tag 'fixes-for-v5.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: usb: phy: am335x: fix race condition in _probe usb: dwc3: exynos: Fix error handling of clk_prepare_enable usb: phy: fix link errors usb: gadget: udc: net2272: Fix bitwise and boolean operations usb: dwc3: gadget: Handle 0 xfer length for OUT EP
2 parents c418fd6 + a53469a commit c7b0c3b

File tree

5 files changed

+6
-9
lines changed

5 files changed

+6
-9
lines changed

drivers/usb/dwc3/dwc3-exynos.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
7878
for (i = 0; i < exynos->num_clks; i++) {
7979
ret = clk_prepare_enable(exynos->clks[i]);
8080
if (ret) {
81-
while (--i > 0)
81+
while (i-- > 0)
8282
clk_disable_unprepare(exynos->clks[i]);
8383
return ret;
8484
}
@@ -223,7 +223,7 @@ static int dwc3_exynos_resume(struct device *dev)
223223
for (i = 0; i < exynos->num_clks; i++) {
224224
ret = clk_prepare_enable(exynos->clks[i]);
225225
if (ret) {
226-
while (--i > 0)
226+
while (i-- > 0)
227227
clk_disable_unprepare(exynos->clks[i]);
228228
return ret;
229229
}

drivers/usb/dwc3/gadget.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
11191119
unsigned int maxp = usb_endpoint_maxp(dep->endpoint.desc);
11201120
unsigned int rem = length % maxp;
11211121

1122-
if (rem && usb_endpoint_dir_out(dep->endpoint.desc)) {
1122+
if ((!length || rem) && usb_endpoint_dir_out(dep->endpoint.desc)) {
11231123
struct dwc3 *dwc = dep->dwc;
11241124
struct dwc3_trb *trb;
11251125

drivers/usb/gadget/udc/net2272.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2083,7 +2083,7 @@ static irqreturn_t net2272_irq(int irq, void *_dev)
20832083
#if defined(PLX_PCI_RDK2)
20842084
/* see if PCI int for us by checking irqstat */
20852085
intcsr = readl(dev->rdk2.fpga_base_addr + RDK2_IRQSTAT);
2086-
if (!intcsr & (1 << NET2272_PCI_IRQ)) {
2086+
if (!(intcsr & (1 << NET2272_PCI_IRQ))) {
20872087
spin_unlock(&dev->lock);
20882088
return IRQ_NONE;
20892089
}

drivers/usb/phy/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ config AB8500_USB
2121

2222
config FSL_USB2_OTG
2323
bool "Freescale USB OTG Transceiver Driver"
24-
depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_OTG_FSM && PM
24+
depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_OTG_FSM=y && PM
2525
depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y'
2626
select USB_PHY
2727
help

drivers/usb/phy/phy-am335x.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ static int am335x_phy_probe(struct platform_device *pdev)
6161
if (ret)
6262
return ret;
6363

64-
ret = usb_add_phy_dev(&am_phy->usb_phy_gen.phy);
65-
if (ret)
66-
return ret;
6764
am_phy->usb_phy_gen.phy.init = am335x_init;
6865
am_phy->usb_phy_gen.phy.shutdown = am335x_shutdown;
6966

@@ -82,7 +79,7 @@ static int am335x_phy_probe(struct platform_device *pdev)
8279
device_set_wakeup_enable(dev, false);
8380
phy_ctrl_power(am_phy->phy_ctrl, am_phy->id, am_phy->dr_mode, false);
8481

85-
return 0;
82+
return usb_add_phy_dev(&am_phy->usb_phy_gen.phy);
8683
}
8784

8885
static int am335x_phy_remove(struct platform_device *pdev)

0 commit comments

Comments
 (0)