aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2013-06-13 10:59:48 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-17 16:45:46 -0400
commit770719df7b2cee6b4c497cfacee9cb8427fd34c2 (patch)
tree79f1ca160b24a8d0d3aced3e1da5f030d55223b3
parente4ce4ecd962e17a92974b3c7ba063d29fce8c86f (diff)
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>
-rw-r--r--drivers/usb/chipidea/ci13xxx_imx.c13
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 = {
98static int ci13xxx_imx_probe(struct platform_device *pdev) 98static int ci13xxx_imx_probe(struct platform_device *pdev)
99{ 99{
100 struct ci13xxx_imx_data *data; 100 struct ci13xxx_imx_data *data;
101 struct platform_device *plat_ci, *phy_pdev; 101 struct platform_device *phy_pdev;
102 struct device_node *phy_np; 102 struct device_node *phy_np;
103 struct resource *res; 103 struct resource *res;
104 struct regulator *reg_vbus; 104 struct regulator *reg_vbus;
@@ -180,11 +180,11 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
180 } 180 }
181 } 181 }
182 182
183 plat_ci = ci13xxx_add_device(&pdev->dev, 183 data->ci_pdev = ci13xxx_add_device(&pdev->dev,
184 pdev->resource, pdev->num_resources, 184 pdev->resource, pdev->num_resources,
185 &ci13xxx_imx_platdata); 185 &ci13xxx_imx_platdata);
186 if (IS_ERR(plat_ci)) { 186 if (IS_ERR(data->ci_pdev)) {
187 ret = PTR_ERR(plat_ci); 187 ret = PTR_ERR(data->ci_pdev);
188 dev_err(&pdev->dev, 188 dev_err(&pdev->dev,
189 "Can't register ci_hdrc platform device, err=%d\n", 189 "Can't register ci_hdrc platform device, err=%d\n",
190 ret); 190 ret);
@@ -196,11 +196,10 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
196 if (ret) { 196 if (ret) {
197 dev_err(&pdev->dev, 197 dev_err(&pdev->dev,
198 "usbmisc post failed, ret=%d\n", ret); 198 "usbmisc post failed, ret=%d\n", ret);
199 goto put_np; 199 goto disable_device;
200 } 200 }
201 } 201 }
202 202
203 data->ci_pdev = plat_ci;
204 platform_set_drvdata(pdev, data); 203 platform_set_drvdata(pdev, data);
205 204
206 pm_runtime_no_callbacks(&pdev->dev); 205 pm_runtime_no_callbacks(&pdev->dev);
@@ -208,6 +207,8 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
208 207
209 return 0; 208 return 0;
210 209
210disable_device:
211 ci13xxx_remove_device(data->ci_pdev);
211err: 212err:
212 if (reg_vbus) 213 if (reg_vbus)
213 regulator_disable(reg_vbus); 214 regulator_disable(reg_vbus);