Commit e56ae54f authored by Fabio Estevam's avatar Fabio Estevam Committed by Greg Kroah-Hartman

usb: chipidea: ci13xxx_imx: remove reg_vbus

There is no need to keep a 'reg_vbus' indirection, so get rid of it.

The motivation for doing this change is that in the case of error, the current
code only sets the local reg_vbus to NULL instead of updating the private
structure 'data->reg_vbus'.

Updating only the local reg_vbus is wrong, since we currently check for
data->reg_vbus in the ci13xxx_imx_remove() function.

In order to avoid such issue, just use 'data->reg_vbus' directly.
Signed-off-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 770719df
...@@ -101,7 +101,6 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) ...@@ -101,7 +101,6 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
struct platform_device *phy_pdev; struct platform_device *phy_pdev;
struct device_node *phy_np; struct device_node *phy_np;
struct resource *res; struct resource *res;
struct regulator *reg_vbus;
int ret; int ret;
if (of_find_property(pdev->dev.of_node, "fsl,usbmisc", NULL) if (of_find_property(pdev->dev.of_node, "fsl,usbmisc", NULL)
...@@ -150,18 +149,17 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) ...@@ -150,18 +149,17 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
} }
/* we only support host now, so enable vbus here */ /* we only support host now, so enable vbus here */
reg_vbus = devm_regulator_get(&pdev->dev, "vbus"); data->reg_vbus = devm_regulator_get(&pdev->dev, "vbus");
if (!IS_ERR(reg_vbus)) { if (!IS_ERR(data->reg_vbus)) {
ret = regulator_enable(reg_vbus); ret = regulator_enable(data->reg_vbus);
if (ret) { if (ret) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Failed to enable vbus regulator, err=%d\n", "Failed to enable vbus regulator, err=%d\n",
ret); ret);
goto put_np; goto put_np;
} }
data->reg_vbus = reg_vbus;
} else { } else {
reg_vbus = NULL; data->reg_vbus = NULL;
} }
ci13xxx_imx_platdata.phy = data->phy; ci13xxx_imx_platdata.phy = data->phy;
...@@ -210,8 +208,8 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) ...@@ -210,8 +208,8 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
disable_device: disable_device:
ci13xxx_remove_device(data->ci_pdev); ci13xxx_remove_device(data->ci_pdev);
err: err:
if (reg_vbus) if (data->reg_vbus)
regulator_disable(reg_vbus); regulator_disable(data->reg_vbus);
put_np: put_np:
if (phy_np) if (phy_np)
of_node_put(phy_np); of_node_put(phy_np);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment