[PATCH usb v4 0/2] fixes on resource check
From: Varka Bhadram var...@cdac.in This series fixes for NULL pointer dereference on resource. Series based on usb-next of [1] changes: Up to v3, combined series for fixes and cleanups for resource check. For v4 seperated as two series on for fixes another for cleanups. [1]: https://git.kernel.org/cgit/linux/kernel/git/gregkh/usb.git Varka Bhadram (2): host: uhci-platform: fix NULL pointer dereference on resource host: ehci-sead3: fix NULL pointer dereference on resource drivers/usb/host/ehci-sead3.c|5 ++--- drivers/usb/host/uhci-platform.c |6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 1/2] host: uhci-platform: fix NULL pointer dereference on resource
From: Varka Bhadram varkabhad...@gmail.com Fix in accessing NULL if resource didn't get. Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/uhci-platform.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c index b987f1d..cf8f460 100644 --- a/drivers/usb/host/uhci-platform.c +++ b/drivers/usb/host/uhci-platform.c @@ -86,14 +86,14 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto err_rmr; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); + uhci = hcd_to_uhci(hcd); uhci-regs = hcd-regs; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 2/2] host: ehci-sead3: fix NULL pointer dereference on resource
From: Varka Bhadram varkabhad...@gmail.com Fix on accessing NULL pointer dereference on get resource failed. Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-sead3.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c index cf12676..9b6e8d0 100644 --- a/drivers/usb/host/ehci-sead3.c +++ b/drivers/usb/host/ehci-sead3.c @@ -110,14 +110,13 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto err1; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); /* Root hub has integrated TT. */ hcd-has_tt = 1; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 01/27] host: ehci-atmel: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-atmel.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c index ec9f7b7..56a8850 100644 --- a/drivers/usb/host/ehci-atmel.c +++ b/drivers/usb/host/ehci-atmel.c @@ -107,22 +107,15 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, - Found HC with no register addr. Check %s setup!\n, - dev_name(pdev-dev)); - retval = -ENODEV; - goto fail_request_resource; - } - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto fail_request_resource; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); + iclk = devm_clk_get(pdev-dev, ehci_clk); if (IS_ERR(iclk)) { dev_err(pdev-dev, Error getting interface clock\n); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 22/27] musb: musb_dsps: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in --- drivers/usb/musb/musb_dsps.c |3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 48bc09e..965c552 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -447,9 +447,6 @@ static int dsps_musb_init(struct musb *musb) int ret; r = platform_get_resource_byname(parent, IORESOURCE_MEM, control); - if (!r) - return -EINVAL; - reg_base = devm_ioremap_resource(dev, r); if (IS_ERR(reg_base)) return PTR_ERR(reg_base); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 24/27] dwc3: dwc3-keystone: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in --- drivers/usb/dwc3/dwc3-keystone.c |5 - 1 file changed, 5 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c index 7ec8495..dd8d2df 100644 --- a/drivers/usb/dwc3/dwc3-keystone.c +++ b/drivers/usb/dwc3/dwc3-keystone.c @@ -104,11 +104,6 @@ static int kdwc3_probe(struct platform_device *pdev) kdwc-dev = dev; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(dev, missing usbss resource\n); - return -EINVAL; - } - kdwc-usbss = devm_ioremap_resource(dev, res); if (IS_ERR(kdwc-usbss)) return PTR_ERR(kdwc-usbss); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 04/27] host: ehci-w90x900: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-w90x900.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ehci-w90x900.c b/drivers/usb/host/ehci-w90x900.c index a9303af..4717bf2 100644 --- a/drivers/usb/host/ehci-w90x900.c +++ b/drivers/usb/host/ehci-w90x900.c @@ -42,27 +42,20 @@ static int usb_w90x900_probe(const struct hc_driver *driver, int retval = 0, irq; unsigned long val; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - retval = -ENXIO; - goto err1; - } - hcd = usb_create_hcd(driver, pdev-dev, w90x900 EHCI); if (!hcd) { retval = -ENOMEM; goto err1; } - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto err2; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); ehci = hcd_to_ehci(hcd); ehci-caps = hcd-regs; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 21/27] musb: musb_core: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in --- drivers/usb/musb/musb_core.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index b841ee0..55ebd4b 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2080,10 +2080,10 @@ static int musb_probe(struct platform_device *pdev) struct resource *iomem; void __iomem*base; - iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!iomem || irq = 0) + if (irq = 0) return -ENODEV; + iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(dev, iomem); if (IS_ERR(base)) return PTR_ERR(base); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 05/27] host: ohci-at91: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-at91.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 6181549..3940660 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -133,12 +133,6 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, struct resource *res; int irq; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_dbg(dev, hcd probe: missing memory resource\n); - return -ENXIO; - } - irq = platform_get_irq(pdev, 0); if (irq 0) { dev_dbg(dev, hcd probe: missing irq resource\n); @@ -148,14 +142,15 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, hcd = usb_create_hcd(driver, dev, at91); if (!hcd) return -ENOMEM; - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(dev, res); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto err; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); iclk = devm_clk_get(dev, ohci_clk); if (IS_ERR(iclk)) { -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 07/27] host: ohci-jz4740: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-jz4740.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ohci-jz4740.c b/drivers/usb/host/ohci-jz4740.c index c2c221a..8ddd8f5 100644 --- a/drivers/usb/host/ohci-jz4740.c +++ b/drivers/usb/host/ohci-jz4740.c @@ -153,13 +153,6 @@ static int jz4740_ohci_probe(struct platform_device *pdev) struct resource *res; int irq; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - - if (!res) { - dev_err(pdev-dev, Failed to get platform resource\n); - return -ENOENT; - } - irq = platform_get_irq(pdev, 0); if (irq 0) { dev_err(pdev-dev, Failed to get platform irq\n); @@ -174,14 +167,14 @@ static int jz4740_ohci_probe(struct platform_device *pdev) jz4740_ohci = hcd_to_jz4740_hcd(hcd); - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto err_free; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); jz4740_ohci-clk = devm_clk_get(pdev-dev, uhc); if (IS_ERR(jz4740_ohci-clk)) { -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 12/27] host: ohci-spear: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-spear.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c index 8d58766..4a54f9d 100644 --- a/drivers/usb/host/ohci-spear.c +++ b/drivers/usb/host/ohci-spear.c @@ -74,20 +74,15 @@ static int spear_ohci_hcd_drv_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - retval = -ENODEV; - goto err_put_hcd; - } - - hcd-rsrc_start = pdev-resource[0].start; - hcd-rsrc_len = resource_size(res); - hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto err_put_hcd; } + hcd-rsrc_start = pdev-resource[0].start; + hcd-rsrc_len = resource_size(res); + sohci_p = to_spear_ohci(hcd); sohci_p-clk = usbh_clk; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 19/27] host: ehci-spear: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-spear.c |9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c index 1355ff0..34e1474 100644 --- a/drivers/usb/host/ehci-spear.c +++ b/drivers/usb/host/ehci-spear.c @@ -99,18 +99,13 @@ static int spear_ehci_hcd_drv_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - retval = -ENODEV; - goto err_put_hcd; - } - - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto err_put_hcd; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); sehci = to_spear_ehci(hcd); sehci-clk = usbh_clk; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 23/27] phy: phy-rcar-usb: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in --- drivers/usb/phy/phy-rcar-usb.c |8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/usb/phy/phy-rcar-usb.c b/drivers/usb/phy/phy-rcar-usb.c index 33265a5..e9f3a93 100644 --- a/drivers/usb/phy/phy-rcar-usb.c +++ b/drivers/usb/phy/phy-rcar-usb.c @@ -195,11 +195,9 @@ static int rcar_usb_phy_probe(struct platform_device *pdev) return PTR_ERR(reg0); res1 = platform_get_resource(pdev, IORESOURCE_MEM, 1); - if (res1) { - reg1 = devm_ioremap_resource(dev, res1); - if (IS_ERR(reg1)) - return PTR_ERR(reg1); - } + reg1 = devm_ioremap_resource(dev, res1); + if (IS_ERR(reg1)) + return PTR_ERR(reg1); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) { -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 20/27] host: xhci-plat: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu Acked-by: Felipe Balbi ba...@ti.com Reviewed-by: Gregory CLEMENT gregory.clem...@free-electrons.com --- drivers/usb/host/xhci-plat.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 3d78b0c..e68b4ec 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -83,9 +83,6 @@ static int xhci_plat_probe(struct platform_device *pdev) if (irq 0) return -ENODEV; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENODEV; if (of_device_is_compatible(pdev-dev.of_node, marvell,armada-375-xhci) || @@ -109,15 +106,16 @@ static int xhci_plat_probe(struct platform_device *pdev) if (!hcd) return -ENOMEM; - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto put_hcd; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); + /* * Not all platforms have a clk so it is not an error if the * clock does not exists. -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 10/27] host: ohci-pxa27x: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-pxa27x.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index e68f3d0..1339981 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c @@ -447,20 +447,13 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device return -ENOMEM; r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!r) { - pr_err(no resource of IORESOURCE_MEM); - retval = -ENXIO; - goto err; - } - - hcd-rsrc_start = r-start; - hcd-rsrc_len = resource_size(r); - hcd-regs = devm_ioremap_resource(pdev-dev, r); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto err; } + hcd-rsrc_start = r-start; + hcd-rsrc_len = resource_size(r); /* initialize struct pxa27x_ohci */ pxa_ohci = to_pxa27x_ohci(hcd); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 27/27] renesas_usbhs: common: remove duplicate check on resource
From: Varka Bhadram var...@cdac.in Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in --- drivers/usb/renesas_usbhs/common.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index 6dae115..169307b 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c @@ -496,9 +496,8 @@ static int usbhs_probe(struct platform_device *pdev) } /* platform data */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!res || !irq_res) { + if (!irq_res) { dev_err(pdev-dev, Not enough Renesas USB platform resources.\n); return -ENODEV; } @@ -508,6 +507,7 @@ static int usbhs_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv-base = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(priv-base)) return PTR_ERR(priv-base); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 06/27] host: ohci-exynos: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-exynos.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 39f366b..035a8a8 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -155,19 +155,13 @@ skip_phy: goto fail_clk; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, Failed to get I/O memory\n); - err = -ENXIO; - goto fail_io; - } - - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { err = PTR_ERR(hcd-regs); goto fail_io; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); irq = platform_get_irq(pdev, 0); if (!irq) { -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 25/27] host: ehci-fsl: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-fsl.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 2d2ae8d..fb7bd0c 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -93,21 +93,15 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver, } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, - Found HC with no register addr. Check %s setup!\n, - dev_name(pdev-dev)); - retval = -ENODEV; - goto err2; - } - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto err2; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); + pdata-regs = hcd-regs; if (pdata-power_budget) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 08/27] host: ohci-octeon: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-octeon.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ohci-octeon.c b/drivers/usb/host/ohci-octeon.c index 15af895..20d861b 100644 --- a/drivers/usb/host/ohci-octeon.c +++ b/drivers/usb/host/ohci-octeon.c @@ -120,12 +120,6 @@ static int ohci_octeon_drv_probe(struct platform_device *pdev) return -ENODEV; } - res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res_mem == NULL) { - dev_err(pdev-dev, No register space assigned\n); - return -ENODEV; - } - /* Ohci is a 32-bit device. */ ret = dma_coerce_mask_and_coherent(pdev-dev, DMA_BIT_MASK(32)); if (ret) @@ -135,14 +129,14 @@ static int ohci_octeon_drv_probe(struct platform_device *pdev) if (!hcd) return -ENOMEM; - hcd-rsrc_start = res_mem-start; - hcd-rsrc_len = resource_size(res_mem); - + res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); reg_base = devm_ioremap_resource(pdev-dev, res_mem); if (IS_ERR(reg_base)) { ret = PTR_ERR(reg_base); goto err1; } + hcd-rsrc_start = res_mem-start; + hcd-rsrc_len = resource_size(res_mem); ohci_octeon_hw_start(); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 14/27] host: ehci-mv: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-mv.c | 12 1 file changed, 12 deletions(-) diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c index b1855c1..849806a 100644 --- a/drivers/usb/host/ehci-mv.c +++ b/drivers/usb/host/ehci-mv.c @@ -169,12 +169,6 @@ static int mv_ehci_probe(struct platform_device *pdev) } r = platform_get_resource_byname(pdev, IORESOURCE_MEM, phyregs); - if (r == NULL) { - dev_err(pdev-dev, no phy I/O memory resource defined\n); - retval = -ENODEV; - goto err_put_hcd; - } - ehci_mv-phy_regs = devm_ioremap_resource(pdev-dev, r); if (IS_ERR(ehci_mv-phy_regs)) { retval = PTR_ERR(ehci_mv-phy_regs); @@ -182,12 +176,6 @@ static int mv_ehci_probe(struct platform_device *pdev) } r = platform_get_resource_byname(pdev, IORESOURCE_MEM, capregs); - if (!r) { - dev_err(pdev-dev, no I/O memory resource defined\n); - retval = -ENODEV; - goto err_put_hcd; - } - ehci_mv-cap_regs = devm_ioremap_resource(pdev-dev, r); if (IS_ERR(ehci_mv-cap_regs)) { retval = PTR_ERR(ehci_mv-cap_regs); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 17/27] host: ehci-orion: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu Reviewed-by: Gregory CLEMENT gregory.clem...@free-electrons.com --- drivers/usb/host/ehci-orion.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index 22e15ca..36b4657 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c @@ -175,15 +175,6 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) goto err; } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, - Found HC with no register addr. Check %s setup!\n, - dev_name(pdev-dev)); - err = -ENODEV; - goto err; - } - /* * Right now device-tree probed devices don't get dma_mask * set. Since shared usb code relies on it, set it here for @@ -193,6 +184,7 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) if (err) goto err; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(regs)) { err = PTR_ERR(regs); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 00/27] cleanup on resource check
From: Varka Bhadram var...@cdac.in This series removes the duplication of sanity check for platform_get_resource() return resource. It will be checked with devm_ioremap_resource(). This entire series rebased on usb-next of [1]. changes since v1: - removed broken patches - added Ack of Alan Stern for all the ehci, ohci, and uhci changes. changes since v2: - addressed Sergei Shtylyov comments changes since v3: - separated as two serieses, one for fixes another for cleanup - added Acked-by of Felipe balbi - added Reviewed-by of Gregory CLEMENT [1]: https://git.kernel.org/cgit/linux/kernel/git/gregkh/usb.git Varka Bhadram (27): host: ehci-atmel: remove duplicate check on resource host: ohci-da8xx: remove duplicate check on resource host: ehci-tegra: remove duplicate check on resource host: ehci-w90x900: remove duplicate check on resource host: ohci-at91: remove duplicate check on resource host: ohci-exynos: remove duplicate check on resource host: ohci-jz4740: remove duplicate check on resource host: ohci-octeon: remove duplicate check on resource host: ohci-platform: remove duplicate check on resource host: ohci-pxa27x: remove duplicate check on resource host: ehci-sh: remove duplicate check on resource host: ohci-spear: remove duplicate check on resource host: ehci-msm: remove duplicate check on resource host: ehci-mv: remove duplicate check on resource host: ehci-mxc: remove duplicate check on resource host: ehci-octeon: remove duplicate check on resource host: ehci-orion: remove duplicate check on resource host: ehci-platform: remove duplicate check on resource host: ehci-spear: remove duplicate check on resource host: xhci-plat: remove duplicate check on resource musb: musb_core: remove duplicate check on resource musb: musb_dsps: remove duplicate check on resource phy: phy-rcar-usb: remove duplicate check on resource dwc3: dwc3-keystone: remove duplicate check on resource host: ehci-fsl: remove duplicate check on resource host: ehci-exynos: remove duplicate check on resource renesas_usbhs: common: remove duplicate check on resource drivers/usb/dwc3/dwc3-keystone.c |5 - drivers/usb/host/ehci-atmel.c | 13 +++-- drivers/usb/host/ehci-exynos.c | 11 +++ drivers/usb/host/ehci-fsl.c| 12 +++- drivers/usb/host/ehci-msm.c| 10 ++ drivers/usb/host/ehci-mv.c | 12 drivers/usb/host/ehci-mxc.c| 11 ++- drivers/usb/host/ehci-octeon.c | 12 +++- drivers/usb/host/ehci-orion.c | 10 +- drivers/usb/host/ehci-platform.c | 12 drivers/usb/host/ehci-sh.c | 15 +++ drivers/usb/host/ehci-spear.c |9 ++--- drivers/usb/host/ehci-tegra.c | 10 +++--- drivers/usb/host/ehci-w90x900.c| 13 +++-- drivers/usb/host/ohci-at91.c | 11 +++ drivers/usb/host/ohci-da8xx.c |7 ++- drivers/usb/host/ohci-exynos.c | 10 ++ drivers/usb/host/ohci-jz4740.c | 13 +++-- drivers/usb/host/ohci-octeon.c | 12 +++- drivers/usb/host/ohci-platform.c | 13 - drivers/usb/host/ohci-pxa27x.c | 11 ++- drivers/usb/host/ohci-spear.c | 11 +++ drivers/usb/host/xhci-plat.c | 10 -- drivers/usb/musb/musb_core.c |4 ++-- drivers/usb/musb/musb_dsps.c |3 --- drivers/usb/phy/phy-rcar-usb.c |8 +++- drivers/usb/renesas_usbhs/common.c |4 ++-- 27 files changed, 65 insertions(+), 207 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 03/27] host: ehci-tegra: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-tegra.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 3e6f685..19a9af1 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c @@ -460,18 +460,14 @@ static int tegra_ehci_probe(struct platform_device *pdev) nvidia,needs-double-reset); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, Failed to get I/O memory\n); - err = -ENXIO; - goto cleanup_clk_en; - } - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { err = PTR_ERR(hcd-regs); goto cleanup_clk_en; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); + ehci-caps = hcd-regs + 0x100; ehci-has_hostpc = soc_config-has_hostpc; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 15/27] host: ehci-mxc: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-mxc.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c index dbe5e4e..c7a9b31 100644 --- a/drivers/usb/host/ehci-mxc.c +++ b/drivers/usb/host/ehci-mxc.c @@ -69,20 +69,13 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(dev, Found HC with no register addr. Check setup!\n); - ret = -ENODEV; - goto err_alloc; - } - - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto err_alloc; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); hcd-has_tt = 1; ehci = hcd_to_ehci(hcd); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 16/27] host: ehci-octeon: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-octeon.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ehci-octeon.c b/drivers/usb/host/ehci-octeon.c index 9051439..2d0c4bc 100644 --- a/drivers/usb/host/ehci-octeon.c +++ b/drivers/usb/host/ehci-octeon.c @@ -106,12 +106,6 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev) return -ENODEV; } - res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res_mem == NULL) { - dev_err(pdev-dev, No register space assigned\n); - return -ENODEV; - } - /* * We can DMA from anywhere. But the descriptors must be in * the lower 4GB. @@ -125,14 +119,14 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev) if (!hcd) return -ENOMEM; - hcd-rsrc_start = res_mem-start; - hcd-rsrc_len = resource_size(res_mem); - + res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(pdev-dev, res_mem); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto err1; } + hcd-rsrc_start = res_mem-start; + hcd-rsrc_len = resource_size(res_mem); ehci_octeon_start(); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 18/27] host: ehci-platform: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-platform.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index da056fe..35a9aed 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -164,11 +164,6 @@ static int ehci_platform_probe(struct platform_device *dev) dev_err(dev-dev, no irq provided); return irq; } - res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); - if (!res_mem) { - dev_err(dev-dev, no memory resource provided); - return -ENXIO; - } hcd = usb_create_hcd(ehci_platform_hc_driver, dev-dev, dev_name(dev-dev)); @@ -250,14 +245,15 @@ static int ehci_platform_probe(struct platform_device *dev) goto err_reset; } - hcd-rsrc_start = res_mem-start; - hcd-rsrc_len = resource_size(res_mem); - + res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(dev-dev, res_mem); if (IS_ERR(hcd-regs)) { err = PTR_ERR(hcd-regs); goto err_power; } + hcd-rsrc_start = res_mem-start; + hcd-rsrc_len = resource_size(res_mem); + err = usb_add_hcd(hcd, irq, IRQF_SHARED); if (err) goto err_power; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 02/27] host: ohci-da8xx: remove duplicate check on resource
From: Varka Bhadram var...@cdac.in Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-da8xx.c |7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index df06be6..1c76999 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -313,16 +313,13 @@ static int usb_hcd_da8xx_probe(const struct hc_driver *driver, return -ENOMEM; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!mem) - return -ENODEV; - hcd-rsrc_start = mem-start; - hcd-rsrc_len = resource_size(mem); - hcd-regs = devm_ioremap_resource(pdev-dev, mem); if (IS_ERR(hcd-regs)) { error = PTR_ERR(hcd-regs); goto err; } + hcd-rsrc_start = mem-start; + hcd-rsrc_len = resource_size(mem); ohci_hcd_init(hcd_to_ohci(hcd)); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v4 13/27] host: ehci-msm: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-msm.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c index 9dc2118..9db74ca 100644 --- a/drivers/usb/host/ehci-msm.c +++ b/drivers/usb/host/ehci-msm.c @@ -88,19 +88,13 @@ static int ehci_msm_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, Unable to get memory resource\n); - ret = -ENODEV; - goto put_hcd; - } - - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto put_hcd; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); /* * OTG driver takes care of PHY initialization, clock management, -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 01/29] host: ehci-atmel: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-atmel.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c index ec9f7b7..56a8850 100644 --- a/drivers/usb/host/ehci-atmel.c +++ b/drivers/usb/host/ehci-atmel.c @@ -107,22 +107,15 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, - Found HC with no register addr. Check %s setup!\n, - dev_name(pdev-dev)); - retval = -ENODEV; - goto fail_request_resource; - } - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto fail_request_resource; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); + iclk = devm_clk_get(pdev-dev, ehci_clk); if (IS_ERR(iclk)) { dev_err(pdev-dev, Error getting interface clock\n); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 02/29] host: ohci-da8xx: remove duplicate check on resource
From: Varka Bhadram var...@cdac.in Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-da8xx.c |7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index df06be6..1c76999 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -313,16 +313,13 @@ static int usb_hcd_da8xx_probe(const struct hc_driver *driver, return -ENOMEM; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!mem) - return -ENODEV; - hcd-rsrc_start = mem-start; - hcd-rsrc_len = resource_size(mem); - hcd-regs = devm_ioremap_resource(pdev-dev, mem); if (IS_ERR(hcd-regs)) { error = PTR_ERR(hcd-regs); goto err; } + hcd-rsrc_start = mem-start; + hcd-rsrc_len = resource_size(mem); ohci_hcd_init(hcd_to_ohci(hcd)); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 00/29] cleanup on resource check
From: Varka Bhadram var...@cdac.in This series removes the duplication of sanity check for platform_get_resource() return resource. It will be checked with devm_ioremap_resource() This entire series rebased on testing/fixes of [1]. [1]: http://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git changes since v1: - removed broken patches - added Ack of Alan Stern for all the ehci, ohci, and uhci changes. Varka Bhadram (29): host: ehci-atmel: remove duplicate check on resource host: ohci-da8xx: remove duplicate check on resource host: ehci-tegra: remove duplicate check on resource host: ehci-w90x900: remove duplicate check on resource host: ohci-at91: remove duplicate check on resource host: ohci-exynos: remove duplicate check on resource host: ohci-jz4740: remove duplicate check on resource host: ohci-octeon: remove duplicate check on resource host: ohci-platform: remove duplicate check on resource host: ohci-pxa27x: remove duplicate check on resource host: ehci-sh: remove duplicate check on resource host: ohci-spear: remove duplicate check on resource host: ehci-msm: remove duplicate check on resource host: ehci-mv: remove duplicate check on resource host: ehci-mxc: remove duplicate check on resource host: ehci-octeon: remove duplicate check on resource host: ehci-orion: remove duplicate check on resource host: ehci-platform: remove duplicate check on resource host: ehci-sead3: remove duplicate check on resource host: ehci-spear: remove duplicate check on resource host: uhci-platform: remove duplicate check on resource host: xhci-plat: remove duplicate check on resource musb: musb_core: remove duplicate check on resource musb: musb_dsps: remove duplicate check on resource phy: phy-rcar-usb: remove duplicate check on resource renesas_usbhs: common: remove duplicate check on resource dwc3: dwc3-keystone: remove duplicate check on resource host: ehci-fsl: remove duplicate check on resource host: ehci-exynos: remove duplicate check on resource drivers/usb/dwc3/dwc3-keystone.c |5 - drivers/usb/host/ehci-atmel.c | 13 +++-- drivers/usb/host/ehci-exynos.c | 11 +++ drivers/usb/host/ehci-fsl.c| 12 +++- drivers/usb/host/ehci-msm.c| 10 ++ drivers/usb/host/ehci-mv.c | 12 drivers/usb/host/ehci-mxc.c| 11 ++- drivers/usb/host/ehci-octeon.c | 12 +++- drivers/usb/host/ehci-orion.c | 10 +- drivers/usb/host/ehci-platform.c | 12 drivers/usb/host/ehci-sead3.c |5 ++--- drivers/usb/host/ehci-sh.c | 15 +++ drivers/usb/host/ehci-spear.c |9 ++--- drivers/usb/host/ehci-tegra.c | 10 +++--- drivers/usb/host/ehci-w90x900.c| 13 +++-- drivers/usb/host/ohci-at91.c | 11 +++ drivers/usb/host/ohci-da8xx.c |7 ++- drivers/usb/host/ohci-exynos.c | 10 ++ drivers/usb/host/ohci-jz4740.c | 13 +++-- drivers/usb/host/ohci-octeon.c | 12 +++- drivers/usb/host/ohci-platform.c | 13 - drivers/usb/host/ohci-pxa27x.c | 11 ++- drivers/usb/host/ohci-spear.c | 11 +++ drivers/usb/host/uhci-platform.c |7 --- drivers/usb/host/xhci-plat.c | 10 -- drivers/usb/musb/musb_core.c |4 ++-- drivers/usb/musb/musb_dsps.c |3 --- drivers/usb/phy/phy-rcar-usb.c |8 +++- drivers/usb/renesas_usbhs/common.c |3 ++- 29 files changed, 71 insertions(+), 212 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 04/29] host: ehci-w90x900: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-w90x900.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ehci-w90x900.c b/drivers/usb/host/ehci-w90x900.c index a9303af..4717bf2 100644 --- a/drivers/usb/host/ehci-w90x900.c +++ b/drivers/usb/host/ehci-w90x900.c @@ -42,27 +42,20 @@ static int usb_w90x900_probe(const struct hc_driver *driver, int retval = 0, irq; unsigned long val; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - retval = -ENXIO; - goto err1; - } - hcd = usb_create_hcd(driver, pdev-dev, w90x900 EHCI); if (!hcd) { retval = -ENOMEM; goto err1; } - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto err2; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); ehci = hcd_to_ehci(hcd); ehci-caps = hcd-regs; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 05/29] host: ohci-at91: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-at91.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index e49eb4f..90666ea 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -137,12 +137,6 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, struct resource *res; int irq; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_dbg(dev, hcd probe: missing memory resource\n); - return -ENXIO; - } - irq = platform_get_irq(pdev, 0); if (irq 0) { dev_dbg(dev, hcd probe: missing irq resource\n); @@ -152,14 +146,15 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, hcd = usb_create_hcd(driver, dev, at91); if (!hcd) return -ENOMEM; - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(dev, res); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto err; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); iclk = devm_clk_get(dev, ohci_clk); if (IS_ERR(iclk)) { -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 03/29] host: ehci-tegra: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-tegra.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index aaa0197..eb36b7a 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c @@ -460,18 +460,14 @@ static int tegra_ehci_probe(struct platform_device *pdev) nvidia,needs-double-reset); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, Failed to get I/O memory\n); - err = -ENXIO; - goto cleanup_clk_en; - } - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { err = PTR_ERR(hcd-regs); goto cleanup_clk_en; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); + ehci-caps = hcd-regs + 0x100; ehci-has_hostpc = soc_config-has_hostpc; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 08/29] host: ohci-octeon: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-octeon.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ohci-octeon.c b/drivers/usb/host/ohci-octeon.c index 15af895..20d861b 100644 --- a/drivers/usb/host/ohci-octeon.c +++ b/drivers/usb/host/ohci-octeon.c @@ -120,12 +120,6 @@ static int ohci_octeon_drv_probe(struct platform_device *pdev) return -ENODEV; } - res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res_mem == NULL) { - dev_err(pdev-dev, No register space assigned\n); - return -ENODEV; - } - /* Ohci is a 32-bit device. */ ret = dma_coerce_mask_and_coherent(pdev-dev, DMA_BIT_MASK(32)); if (ret) @@ -135,14 +129,14 @@ static int ohci_octeon_drv_probe(struct platform_device *pdev) if (!hcd) return -ENOMEM; - hcd-rsrc_start = res_mem-start; - hcd-rsrc_len = resource_size(res_mem); - + res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); reg_base = devm_ioremap_resource(pdev-dev, res_mem); if (IS_ERR(reg_base)) { ret = PTR_ERR(reg_base); goto err1; } + hcd-rsrc_start = res_mem-start; + hcd-rsrc_len = resource_size(res_mem); ohci_octeon_hw_start(); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 06/29] host: ohci-exynos: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-exynos.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index d28b658..f601952 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -156,19 +156,13 @@ skip_phy: goto fail_clk; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, Failed to get I/O memory\n); - err = -ENXIO; - goto fail_io; - } - - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { err = PTR_ERR(hcd-regs); goto fail_io; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); irq = platform_get_irq(pdev, 0); if (!irq) { -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 09/29] host: ohci-platform: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-platform.c | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index 4369299..6c7f74b 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -149,12 +149,6 @@ static int ohci_platform_probe(struct platform_device *dev) return irq; } - res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); - if (!res_mem) { - dev_err(dev-dev, no memory resource provided); - return -ENXIO; - } - hcd = usb_create_hcd(ohci_platform_hc_driver, dev-dev, dev_name(dev-dev)); if (!hcd) @@ -236,14 +230,15 @@ static int ohci_platform_probe(struct platform_device *dev) goto err_reset; } - hcd-rsrc_start = res_mem-start; - hcd-rsrc_len = resource_size(res_mem); - + res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(dev-dev, res_mem); if (IS_ERR(hcd-regs)) { err = PTR_ERR(hcd-regs); goto err_power; } + hcd-rsrc_start = res_mem-start; + hcd-rsrc_len = resource_size(res_mem); + err = usb_add_hcd(hcd, irq, IRQF_SHARED); if (err) goto err_power; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 07/29] host: ohci-jz4740: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-jz4740.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ohci-jz4740.c b/drivers/usb/host/ohci-jz4740.c index c2c221a..8ddd8f5 100644 --- a/drivers/usb/host/ohci-jz4740.c +++ b/drivers/usb/host/ohci-jz4740.c @@ -153,13 +153,6 @@ static int jz4740_ohci_probe(struct platform_device *pdev) struct resource *res; int irq; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - - if (!res) { - dev_err(pdev-dev, Failed to get platform resource\n); - return -ENOENT; - } - irq = platform_get_irq(pdev, 0); if (irq 0) { dev_err(pdev-dev, Failed to get platform irq\n); @@ -174,14 +167,14 @@ static int jz4740_ohci_probe(struct platform_device *pdev) jz4740_ohci = hcd_to_jz4740_hcd(hcd); - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto err_free; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); jz4740_ohci-clk = devm_clk_get(pdev-dev, uhc); if (IS_ERR(jz4740_ohci-clk)) { -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 11/29] host: ehci-sh: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-sh.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c index 9b9b9f5..4b2c3a7 100644 --- a/drivers/usb/host/ehci-sh.c +++ b/drivers/usb/host/ehci-sh.c @@ -86,15 +86,6 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev) if (usb_disabled()) return -ENODEV; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, - Found HC with no register addr. Check %s setup!\n, - dev_name(pdev-dev)); - ret = -ENODEV; - goto fail_create_hcd; - } - irq = platform_get_irq(pdev, 0); if (irq = 0) { dev_err(pdev-dev, @@ -114,14 +105,14 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev) goto fail_create_hcd; } - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto fail_request_resource; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); priv = devm_kzalloc(pdev-dev, sizeof(struct ehci_sh_priv), GFP_KERNEL); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 12/29] host: ohci-spear: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-spear.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c index 8d58766..4a54f9d 100644 --- a/drivers/usb/host/ohci-spear.c +++ b/drivers/usb/host/ohci-spear.c @@ -74,20 +74,15 @@ static int spear_ohci_hcd_drv_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - retval = -ENODEV; - goto err_put_hcd; - } - - hcd-rsrc_start = pdev-resource[0].start; - hcd-rsrc_len = resource_size(res); - hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto err_put_hcd; } + hcd-rsrc_start = pdev-resource[0].start; + hcd-rsrc_len = resource_size(res); + sohci_p = to_spear_ohci(hcd); sohci_p-clk = usbh_clk; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 13/29] host: ehci-msm: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-msm.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c index 9dc2118..9db74ca 100644 --- a/drivers/usb/host/ehci-msm.c +++ b/drivers/usb/host/ehci-msm.c @@ -88,19 +88,13 @@ static int ehci_msm_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, Unable to get memory resource\n); - ret = -ENODEV; - goto put_hcd; - } - - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto put_hcd; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); /* * OTG driver takes care of PHY initialization, clock management, -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 10/29] host: ohci-pxa27x: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-pxa27x.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index e68f3d0..1339981 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c @@ -447,20 +447,13 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device return -ENOMEM; r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!r) { - pr_err(no resource of IORESOURCE_MEM); - retval = -ENXIO; - goto err; - } - - hcd-rsrc_start = r-start; - hcd-rsrc_len = resource_size(r); - hcd-regs = devm_ioremap_resource(pdev-dev, r); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto err; } + hcd-rsrc_start = r-start; + hcd-rsrc_len = resource_size(r); /* initialize struct pxa27x_ohci */ pxa_ohci = to_pxa27x_ohci(hcd); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 16/29] host: ehci-octeon: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-octeon.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ehci-octeon.c b/drivers/usb/host/ehci-octeon.c index 9051439..2d0c4bc 100644 --- a/drivers/usb/host/ehci-octeon.c +++ b/drivers/usb/host/ehci-octeon.c @@ -106,12 +106,6 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev) return -ENODEV; } - res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res_mem == NULL) { - dev_err(pdev-dev, No register space assigned\n); - return -ENODEV; - } - /* * We can DMA from anywhere. But the descriptors must be in * the lower 4GB. @@ -125,14 +119,14 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev) if (!hcd) return -ENOMEM; - hcd-rsrc_start = res_mem-start; - hcd-rsrc_len = resource_size(res_mem); - + res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(pdev-dev, res_mem); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto err1; } + hcd-rsrc_start = res_mem-start; + hcd-rsrc_len = resource_size(res_mem); ehci_octeon_start(); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 19/29] host: ehci-sead3: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-sead3.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c index cf12676..9b6e8d0 100644 --- a/drivers/usb/host/ehci-sead3.c +++ b/drivers/usb/host/ehci-sead3.c @@ -110,14 +110,13 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto err1; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); /* Root hub has integrated TT. */ hcd-has_tt = 1; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 25/29] phy: phy-rcar-usb: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in --- drivers/usb/phy/phy-rcar-usb.c |8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/usb/phy/phy-rcar-usb.c b/drivers/usb/phy/phy-rcar-usb.c index 33265a5..e9f3a93 100644 --- a/drivers/usb/phy/phy-rcar-usb.c +++ b/drivers/usb/phy/phy-rcar-usb.c @@ -195,11 +195,9 @@ static int rcar_usb_phy_probe(struct platform_device *pdev) return PTR_ERR(reg0); res1 = platform_get_resource(pdev, IORESOURCE_MEM, 1); - if (res1) { - reg1 = devm_ioremap_resource(dev, res1); - if (IS_ERR(reg1)) - return PTR_ERR(reg1); - } + reg1 = devm_ioremap_resource(dev, res1); + if (IS_ERR(reg1)) + return PTR_ERR(reg1); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) { -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 22/29] host: xhci-plat: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/xhci-plat.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 3d78b0c..e68b4ec 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -83,9 +83,6 @@ static int xhci_plat_probe(struct platform_device *pdev) if (irq 0) return -ENODEV; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENODEV; if (of_device_is_compatible(pdev-dev.of_node, marvell,armada-375-xhci) || @@ -109,15 +106,16 @@ static int xhci_plat_probe(struct platform_device *pdev) if (!hcd) return -ENOMEM; - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto put_hcd; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); + /* * Not all platforms have a clk so it is not an error if the * clock does not exists. -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 23/29] musb: musb_core: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in --- drivers/usb/musb/musb_core.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index b841ee0..55ebd4b 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2080,10 +2080,10 @@ static int musb_probe(struct platform_device *pdev) struct resource *iomem; void __iomem*base; - iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!iomem || irq = 0) + if (irq = 0) return -ENODEV; + iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(dev, iomem); if (IS_ERR(base)) return PTR_ERR(base); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 21/29] host: uhci-platform: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Also fix in accessing NULL if resource didn't get. Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/uhci-platform.c |7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c index b987f1d..081330c 100644 --- a/drivers/usb/host/uhci-platform.c +++ b/drivers/usb/host/uhci-platform.c @@ -86,14 +86,15 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto err_rmr; } + + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); + uhci = hcd_to_uhci(hcd); uhci-regs = hcd-regs; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 27/29] dwc3: dwc3-keystone: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in --- drivers/usb/dwc3/dwc3-keystone.c |5 - 1 file changed, 5 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c index 7ec8495..dd8d2df 100644 --- a/drivers/usb/dwc3/dwc3-keystone.c +++ b/drivers/usb/dwc3/dwc3-keystone.c @@ -104,11 +104,6 @@ static int kdwc3_probe(struct platform_device *pdev) kdwc-dev = dev; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(dev, missing usbss resource\n); - return -EINVAL; - } - kdwc-usbss = devm_ioremap_resource(dev, res); if (IS_ERR(kdwc-usbss)) return PTR_ERR(kdwc-usbss); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 15/29] host: ehci-mxc: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-mxc.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c index dbe5e4e..c7a9b31 100644 --- a/drivers/usb/host/ehci-mxc.c +++ b/drivers/usb/host/ehci-mxc.c @@ -69,20 +69,13 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(dev, Found HC with no register addr. Check setup!\n); - ret = -ENODEV; - goto err_alloc; - } - - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto err_alloc; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); hcd-has_tt = 1; ehci = hcd_to_ehci(hcd); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 29/29] host: ehci-exynos: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-exynos.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index 7189f2e..c2777d2 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -188,20 +188,15 @@ skip_phy: goto fail_clk; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, Failed to get I/O memory\n); - err = -ENXIO; - goto fail_io; - } - - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { err = PTR_ERR(hcd-regs); goto fail_io; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); + irq = platform_get_irq(pdev, 0); if (!irq) { dev_err(pdev-dev, Failed to get IRQ\n); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 28/29] host: ehci-fsl: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-fsl.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 2d2ae8d..fb7bd0c 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -93,21 +93,15 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver, } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, - Found HC with no register addr. Check %s setup!\n, - dev_name(pdev-dev)); - retval = -ENODEV; - goto err2; - } - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto err2; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); + pdata-regs = hcd-regs; if (pdata-power_budget) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 24/29] musb: musb_dsps: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in --- drivers/usb/musb/musb_dsps.c |3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 48bc09e..965c552 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -447,9 +447,6 @@ static int dsps_musb_init(struct musb *musb) int ret; r = platform_get_resource_byname(parent, IORESOURCE_MEM, control); - if (!r) - return -EINVAL; - reg_base = devm_ioremap_resource(dev, r); if (IS_ERR(reg_base)) return PTR_ERR(reg_base); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 26/29] renesas_usbhs: common: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in --- drivers/usb/renesas_usbhs/common.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index b3b6813..3ffd552 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c @@ -497,8 +497,9 @@ static int usbhs_probe(struct platform_device *pdev) /* platform data */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!res || !irq_res) { + if (!irq_res) { dev_err(pdev-dev, Not enough Renesas USB platform resources.\n); return -ENODEV; } -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 20/29] host: ehci-spear: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-spear.c |9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c index 1355ff0..34e1474 100644 --- a/drivers/usb/host/ehci-spear.c +++ b/drivers/usb/host/ehci-spear.c @@ -99,18 +99,13 @@ static int spear_ehci_hcd_drv_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - retval = -ENODEV; - goto err_put_hcd; - } - - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto err_put_hcd; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); sehci = to_spear_ehci(hcd); sehci-clk = usbh_clk; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html