Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'usb-4.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB / PHY driver fixes from Greg KH:
"Here are two small sets of patches, both from subsystem trees, USB
gadget and PHY drivers.

Full details are in the shortlog, and they have all been in linux-next
for a while (before I merged them to the USB tree)"

* tag 'usb-4.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
usb: gadget: f_fs: Fix use-after-free
usb: dwc3: gadget: Fix suspend/resume during device mode
usb: dwc3: fix memory leak of dwc->regset
usb: dwc3: core: fix PHY handling during suspend
usb: dwc3: omap: fix up error path on probe()
usb: gadget: composite: Clear reserved fields of SSP Dev Cap
phy: rockchip-emmc: adapt binding to specifiy register offset and length
phy: rockchip-emmc: should be a child device of the GRF
phy: rockchip-dp: should be a child device of the GRF

+78 -35
+11 -7
Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt
··· 8 8 of memory mapped region. 9 9 - clock-names: from common clock binding: 10 10 Required elements: "24m" 11 - - rockchip,grf: phandle to the syscon managing the "general register files" 12 11 - #phy-cells : from the generic PHY bindings, must be 0; 13 12 14 13 Example: 15 14 16 - edp_phy: edp-phy { 17 - compatible = "rockchip,rk3288-dp-phy"; 18 - rockchip,grf = <&grf>; 19 - clocks = <&cru SCLK_EDP_24M>; 20 - clock-names = "24m"; 21 - #phy-cells = <0>; 15 + grf: syscon@ff770000 { 16 + compatible = "rockchip,rk3288-grf", "syscon", "simple-mfd"; 17 + 18 + ... 19 + 20 + edp_phy: edp-phy { 21 + compatible = "rockchip,rk3288-dp-phy"; 22 + clocks = <&cru SCLK_EDP_24M>; 23 + clock-names = "24m"; 24 + #phy-cells = <0>; 25 + }; 22 26 };
+14 -8
Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
··· 3 3 4 4 Required properties: 5 5 - compatible: rockchip,rk3399-emmc-phy 6 - - rockchip,grf : phandle to the syscon managing the "general 7 - register files" 8 6 - #phy-cells: must be 0 9 - - reg: PHY configure reg address offset in "general 7 + - reg: PHY register address offset and length in "general 10 8 register files" 11 9 12 10 Example: 13 11 14 - emmcphy: phy { 15 - compatible = "rockchip,rk3399-emmc-phy"; 16 - rockchip,grf = <&grf>; 17 - reg = <0xf780>; 18 - #phy-cells = <0>; 12 + 13 + grf: syscon@ff770000 { 14 + compatible = "rockchip,rk3399-grf", "syscon", "simple-mfd"; 15 + #address-cells = <1>; 16 + #size-cells = <1>; 17 + 18 + ... 19 + 20 + emmcphy: phy@f780 { 21 + compatible = "rockchip,rk3399-emmc-phy"; 22 + reg = <0xf780 0x20>; 23 + #phy-cells = <0>; 24 + }; 19 25 };
+5 -2
drivers/phy/phy-rockchip-dp.c
··· 86 86 if (!np) 87 87 return -ENODEV; 88 88 89 + if (!dev->parent || !dev->parent->of_node) 90 + return -ENODEV; 91 + 89 92 dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL); 90 93 if (IS_ERR(dp)) 91 94 return -ENOMEM; ··· 107 104 return ret; 108 105 } 109 106 110 - dp->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); 107 + dp->grf = syscon_node_to_regmap(dev->parent->of_node); 111 108 if (IS_ERR(dp->grf)) { 112 - dev_err(dev, "rk3288-dp needs rockchip,grf property\n"); 109 + dev_err(dev, "rk3288-dp needs the General Register Files syscon\n"); 113 110 return PTR_ERR(dp->grf); 114 111 } 115 112
+4 -1
drivers/phy/phy-rockchip-emmc.c
··· 176 176 struct regmap *grf; 177 177 unsigned int reg_offset; 178 178 179 - grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf"); 179 + if (!dev->parent || !dev->parent->of_node) 180 + return -ENODEV; 181 + 182 + grf = syscon_node_to_regmap(dev->parent->of_node); 180 183 if (IS_ERR(grf)) { 181 184 dev_err(dev, "Missing rockchip,grf property\n"); 182 185 return PTR_ERR(grf);
+22 -1
drivers/usb/dwc3/core.c
··· 1150 1150 phy_exit(dwc->usb2_generic_phy); 1151 1151 phy_exit(dwc->usb3_generic_phy); 1152 1152 1153 + usb_phy_set_suspend(dwc->usb2_phy, 1); 1154 + usb_phy_set_suspend(dwc->usb3_phy, 1); 1155 + WARN_ON(phy_power_off(dwc->usb2_generic_phy) < 0); 1156 + WARN_ON(phy_power_off(dwc->usb3_generic_phy) < 0); 1157 + 1153 1158 pinctrl_pm_select_sleep_state(dev); 1154 1159 1155 1160 return 0; ··· 1168 1163 1169 1164 pinctrl_pm_select_default_state(dev); 1170 1165 1166 + usb_phy_set_suspend(dwc->usb2_phy, 0); 1167 + usb_phy_set_suspend(dwc->usb3_phy, 0); 1168 + ret = phy_power_on(dwc->usb2_generic_phy); 1169 + if (ret < 0) 1170 + return ret; 1171 + 1172 + ret = phy_power_on(dwc->usb3_generic_phy); 1173 + if (ret < 0) 1174 + goto err_usb2phy_power; 1175 + 1171 1176 usb_phy_init(dwc->usb3_phy); 1172 1177 usb_phy_init(dwc->usb2_phy); 1173 1178 ret = phy_init(dwc->usb2_generic_phy); 1174 1179 if (ret < 0) 1175 - return ret; 1180 + goto err_usb3phy_power; 1176 1181 1177 1182 ret = phy_init(dwc->usb3_generic_phy); 1178 1183 if (ret < 0) ··· 1214 1199 1215 1200 err_usb2phy_init: 1216 1201 phy_exit(dwc->usb2_generic_phy); 1202 + 1203 + err_usb3phy_power: 1204 + phy_power_off(dwc->usb3_generic_phy); 1205 + 1206 + err_usb2phy_power: 1207 + phy_power_off(dwc->usb2_generic_phy); 1217 1208 1218 1209 return ret; 1219 1210 }
+8 -5
drivers/usb/dwc3/debugfs.c
··· 645 645 file = debugfs_create_regset32("regdump", S_IRUGO, root, dwc->regset); 646 646 if (!file) { 647 647 ret = -ENOMEM; 648 - goto err1; 648 + goto err2; 649 649 } 650 650 651 651 if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)) { ··· 653 653 dwc, &dwc3_mode_fops); 654 654 if (!file) { 655 655 ret = -ENOMEM; 656 - goto err1; 656 + goto err2; 657 657 } 658 658 } 659 659 ··· 663 663 dwc, &dwc3_testmode_fops); 664 664 if (!file) { 665 665 ret = -ENOMEM; 666 - goto err1; 666 + goto err2; 667 667 } 668 668 669 669 file = debugfs_create_file("link_state", S_IRUGO | S_IWUSR, root, 670 670 dwc, &dwc3_link_state_fops); 671 671 if (!file) { 672 672 ret = -ENOMEM; 673 - goto err1; 673 + goto err2; 674 674 } 675 675 } 676 676 677 677 return 0; 678 + 679 + err2: 680 + kfree(dwc->regset); 678 681 679 682 err1: 680 683 debugfs_remove_recursive(root); ··· 689 686 void dwc3_debugfs_exit(struct dwc3 *dwc) 690 687 { 691 688 debugfs_remove_recursive(dwc->root); 692 - dwc->root = NULL; 689 + kfree(dwc->regset); 693 690 }
+4 -8
drivers/usb/dwc3/dwc3-omap.c
··· 496 496 ret = pm_runtime_get_sync(dev); 497 497 if (ret < 0) { 498 498 dev_err(dev, "get_sync failed with err %d\n", ret); 499 - goto err0; 499 + goto err1; 500 500 } 501 501 502 502 dwc3_omap_map_offset(omap); ··· 516 516 517 517 ret = dwc3_omap_extcon_register(omap); 518 518 if (ret < 0) 519 - goto err2; 519 + goto err1; 520 520 521 521 ret = of_platform_populate(node, NULL, NULL, dev); 522 522 if (ret) { 523 523 dev_err(&pdev->dev, "failed to create dwc3 core\n"); 524 - goto err3; 524 + goto err2; 525 525 } 526 526 527 527 dwc3_omap_enable_irqs(omap); 528 528 529 529 return 0; 530 530 531 - err3: 531 + err2: 532 532 extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb); 533 533 extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb); 534 - err2: 535 - dwc3_omap_disable_irqs(omap); 536 534 537 535 err1: 538 536 pm_runtime_put_sync(dev); 539 - 540 - err0: 541 537 pm_runtime_disable(dev); 542 538 543 539 return ret;
+6
drivers/usb/dwc3/gadget.c
··· 2936 2936 2937 2937 int dwc3_gadget_suspend(struct dwc3 *dwc) 2938 2938 { 2939 + if (!dwc->gadget_driver) 2940 + return 0; 2941 + 2939 2942 if (dwc->pullups_connected) { 2940 2943 dwc3_gadget_disable_irq(dwc); 2941 2944 dwc3_gadget_run_stop(dwc, true, true); ··· 2956 2953 { 2957 2954 struct dwc3_ep *dep; 2958 2955 int ret; 2956 + 2957 + if (!dwc->gadget_driver) 2958 + return 0; 2959 2959 2960 2960 /* Start with SuperSpeed Default */ 2961 2961 dwc3_gadget_ep0_desc.wMaxPacketSize = cpu_to_le16(512);
+2
drivers/usb/gadget/composite.c
··· 651 651 ssp_cap->bLength = USB_DT_USB_SSP_CAP_SIZE(1); 652 652 ssp_cap->bDescriptorType = USB_DT_DEVICE_CAPABILITY; 653 653 ssp_cap->bDevCapabilityType = USB_SSP_CAP_TYPE; 654 + ssp_cap->bReserved = 0; 655 + ssp_cap->wReserved = 0; 654 656 655 657 /* SSAC = 1 (2 attributes) */ 656 658 ssp_cap->bmAttributes = cpu_to_le32(1);
+2 -3
drivers/usb/gadget/function/f_fs.c
··· 646 646 work); 647 647 int ret = io_data->req->status ? io_data->req->status : 648 648 io_data->req->actual; 649 + bool kiocb_has_eventfd = io_data->kiocb->ki_flags & IOCB_EVENTFD; 649 650 650 651 if (io_data->read && ret > 0) { 651 652 use_mm(io_data->mm); ··· 658 657 659 658 io_data->kiocb->ki_complete(io_data->kiocb, ret, ret); 660 659 661 - if (io_data->ffs->ffs_eventfd && 662 - !(io_data->kiocb->ki_flags & IOCB_EVENTFD)) 660 + if (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd) 663 661 eventfd_signal(io_data->ffs->ffs_eventfd, 1); 664 662 665 663 usb_ep_free_request(io_data->ep, io_data->req); 666 664 667 - io_data->kiocb->private = NULL; 668 665 if (io_data->read) 669 666 kfree(io_data->to_free); 670 667 kfree(io_data->buf);