diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2013-06-13 17:59:48 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-17 13:45:46 -0700 |
commit | 770719df7b2cee6b4c497cfacee9cb8427fd34c2 (patch) | |
tree | 79f1ca160b24a8d0d3aced3e1da5f030d55223b3 /drivers | |
parent | e4ce4ecd962e17a92974b3c7ba063d29fce8c86f (diff) | |
download | linux-770719df7b2cee6b4c497cfacee9cb8427fd34c2.tar.bz2 |
usb: chipidea: ci13xxx_imx: fix error path
If usbmisc_ops->post() fails it should point the error path to release all
previously acquired resources, so adjust it to call ci13xxx_remove_device().
While at it, remove the unnecessary 'plat_ci' indirection, as we can directly
use the private structure.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/chipidea/ci13xxx_imx.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c index 45bb9b5ebc35..24f46e1f043a 100644 --- a/drivers/usb/chipidea/ci13xxx_imx.c +++ b/drivers/usb/chipidea/ci13xxx_imx.c @@ -98,7 +98,7 @@ static struct ci13xxx_platform_data ci13xxx_imx_platdata = { static int ci13xxx_imx_probe(struct platform_device *pdev) { struct ci13xxx_imx_data *data; - struct platform_device *plat_ci, *phy_pdev; + struct platform_device *phy_pdev; struct device_node *phy_np; struct resource *res; struct regulator *reg_vbus; @@ -180,11 +180,11 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) } } - plat_ci = ci13xxx_add_device(&pdev->dev, + data->ci_pdev = ci13xxx_add_device(&pdev->dev, pdev->resource, pdev->num_resources, &ci13xxx_imx_platdata); - if (IS_ERR(plat_ci)) { - ret = PTR_ERR(plat_ci); + if (IS_ERR(data->ci_pdev)) { + ret = PTR_ERR(data->ci_pdev); dev_err(&pdev->dev, "Can't register ci_hdrc platform device, err=%d\n", ret); @@ -196,11 +196,10 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) if (ret) { dev_err(&pdev->dev, "usbmisc post failed, ret=%d\n", ret); - goto put_np; + goto disable_device; } } - data->ci_pdev = plat_ci; platform_set_drvdata(pdev, data); pm_runtime_no_callbacks(&pdev->dev); @@ -208,6 +207,8 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) return 0; +disable_device: + ci13xxx_remove_device(data->ci_pdev); err: if (reg_vbus) regulator_disable(reg_vbus); |