usb: ehci-s5p: Use devm for requesting ehci_vbus_gpio
Quoted 15 lines · Doug Anderson
The
ehci_vbus_gpiois requested but never freed. This can cause problems with deferred probes and would cause problems ifs5p_ehci_removewas ever called. Use devm to fix this.Signed-off-by Doug Anderson <[email protected]>--- drivers/usb/host/ehci-s5p.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/usb/host/ehci-s5p.c +0
-0
drivers/usb/host/ehci-s5p.c static void s5p_ehci_phy_disable(struct s5p_ehci_hcd *s5p_ehci) · line 95
Quoted 4 lines
drivers/usb/host/ehci-s5p.c +1
-0@@ -92,6 +92,7 @@ static void s5p_ehci_phy_disable(struct s5p_ehci_hcd *s5p_ehci)static void s5p_setup_vbus_gpio (struct platform_device *pdev) { +struct device *dev = &pdev->dev;
Hi Doug Anderson,
Would you replace other '&pdev->dev' with 'dev' in s5p_setup_vbus_gpio() as below? It seems to be better for readability.
- gpio = of_get_named_gpio(pdev->dev.of_node,
+ gpio = of_get_named_gpio(dev->of_node,
"samsung,vbus-gpio", 0);
if (!gpio_is_valid(gpio))
return;- err = gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "ehci_vbus_gpio");
+ err = devm_gpio_request_one(dev, gpio, GPIOF_OUT_INIT_HIGH,
+ "ehci_vbus_gpio");
if (err)
- dev_err(&pdev->dev, "can't request ehci vbus gpio %d", gpio);
+ dev_err(dev, "can't request ehci vbus gpio %d", gpio);
Best regards,
Jingoo Han
Quoted 14 lines
drivers/usb/host/ehci-s5p.c +2
-2int err;int gpio;@@ -103,7 +104,8 @@ static void s5p_setup_vbus_gpio(struct platform_device *pdev)if (!gpio_is_valid (gpio))return ; - err =gpio_request_one (gpio,GPIOF_OUT_INIT_HIGH ,"ehci_vbus_gpio" ); + err =devm_gpio_request_one (dev, gpio,GPIOF_OUT_INIT_HIGH , +"ehci_vbus_gpio" );if (err)dev_err (&pdev->dev,"can't request ehci vbus gpio %d" , gpio); } --
Quoted 1 line
1.8.1.3
�淸�{.n�+돴윯돪�+%듚�깁負쪐w��{.n�+돴쪐{깸G쳺��{ay����,j�f"톒쉹��묎�z_溫(�쉸듶줷"얎�m����G쳺�◀?솳鈺�&x�~뤳턨O뺞촾퇉v�^�m����띠�◀?뻀�
Jingoo,
Quoted 2 lines · Jingoo Han
Would you replace other '
&pdev->dev' with 'dev' ins5p_setup_vbus_gpio()as below? It seems to be better for readability.
Yes, of course. That was silly of me not to add the "dev" local and not update the other places... Thanks for your review!
-Doug