diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2013-06-13 10:59:49 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-17 16:45:46 -0400 |
commit | e56ae54ff157701ab811b03cab195d8e5eca6628 (patch) | |
tree | 6e9371772fabcb82208fb3feb75cb542ba106ac8 /drivers/usb/chipidea | |
parent | 770719df7b2cee6b4c497cfacee9cb8427fd34c2 (diff) |
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: 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/usb/chipidea')
-rw-r--r-- | drivers/usb/chipidea/ci13xxx_imx.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c index 24f46e1f043a..1b100c8e3835 100644 --- a/drivers/usb/chipidea/ci13xxx_imx.c +++ b/drivers/usb/chipidea/ci13xxx_imx.c | |||
@@ -101,7 +101,6 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) | |||
101 | struct platform_device *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; | ||
105 | int ret; | 104 | int ret; |
106 | 105 | ||
107 | if (of_find_property(pdev->dev.of_node, "fsl,usbmisc", NULL) | 106 | 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 | } | 149 | } |
151 | 150 | ||
152 | /* we only support host now, so enable vbus here */ | 151 | /* we only support host now, so enable vbus here */ |
153 | reg_vbus = devm_regulator_get(&pdev->dev, "vbus"); | 152 | data->reg_vbus = devm_regulator_get(&pdev->dev, "vbus"); |
154 | if (!IS_ERR(reg_vbus)) { | 153 | if (!IS_ERR(data->reg_vbus)) { |
155 | ret = regulator_enable(reg_vbus); | 154 | ret = regulator_enable(data->reg_vbus); |
156 | if (ret) { | 155 | if (ret) { |
157 | dev_err(&pdev->dev, | 156 | dev_err(&pdev->dev, |
158 | "Failed to enable vbus regulator, err=%d\n", | 157 | "Failed to enable vbus regulator, err=%d\n", |
159 | ret); | 158 | ret); |
160 | goto put_np; | 159 | goto put_np; |
161 | } | 160 | } |
162 | data->reg_vbus = reg_vbus; | ||
163 | } else { | 161 | } else { |
164 | reg_vbus = NULL; | 162 | data->reg_vbus = NULL; |
165 | } | 163 | } |
166 | 164 | ||
167 | ci13xxx_imx_platdata.phy = data->phy; | 165 | ci13xxx_imx_platdata.phy = data->phy; |
@@ -210,8 +208,8 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) | |||
210 | disable_device: | 208 | disable_device: |
211 | ci13xxx_remove_device(data->ci_pdev); | 209 | ci13xxx_remove_device(data->ci_pdev); |
212 | err: | 210 | err: |
213 | if (reg_vbus) | 211 | if (data->reg_vbus) |
214 | regulator_disable(reg_vbus); | 212 | regulator_disable(data->reg_vbus); |
215 | put_np: | 213 | put_np: |
216 | if (phy_np) | 214 | if (phy_np) |
217 | of_node_put(phy_np); | 215 | of_node_put(phy_np); |