| .. | .. |
|---|
| 206 | 206 | if (!dwc3_data) |
|---|
| 207 | 207 | return -ENOMEM; |
|---|
| 208 | 208 | |
|---|
| 209 | | - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "reg-glue"); |
|---|
| 210 | | - dwc3_data->glue_base = devm_ioremap_resource(dev, res); |
|---|
| 209 | + dwc3_data->glue_base = |
|---|
| 210 | + devm_platform_ioremap_resource_byname(pdev, "reg-glue"); |
|---|
| 211 | 211 | if (IS_ERR(dwc3_data->glue_base)) |
|---|
| 212 | 212 | return PTR_ERR(dwc3_data->glue_base); |
|---|
| 213 | 213 | |
|---|
| .. | .. |
|---|
| 255 | 255 | if (!child) { |
|---|
| 256 | 256 | dev_err(&pdev->dev, "failed to find dwc3 core node\n"); |
|---|
| 257 | 257 | ret = -ENODEV; |
|---|
| 258 | | - goto undo_softreset; |
|---|
| 258 | + goto err_node_put; |
|---|
| 259 | 259 | } |
|---|
| 260 | 260 | |
|---|
| 261 | 261 | /* Allocate and initialize the core */ |
|---|
| 262 | 262 | ret = of_platform_populate(node, NULL, NULL, dev); |
|---|
| 263 | 263 | if (ret) { |
|---|
| 264 | 264 | dev_err(dev, "failed to add dwc3 core\n"); |
|---|
| 265 | | - goto undo_softreset; |
|---|
| 265 | + goto err_node_put; |
|---|
| 266 | 266 | } |
|---|
| 267 | 267 | |
|---|
| 268 | 268 | child_pdev = of_find_device_by_node(child); |
|---|
| 269 | 269 | if (!child_pdev) { |
|---|
| 270 | 270 | dev_err(dev, "failed to find dwc3 core device\n"); |
|---|
| 271 | 271 | ret = -ENODEV; |
|---|
| 272 | | - goto undo_softreset; |
|---|
| 272 | + goto err_node_put; |
|---|
| 273 | 273 | } |
|---|
| 274 | 274 | |
|---|
| 275 | 275 | dwc3_data->dr_mode = usb_get_dr_mode(&child_pdev->dev); |
|---|
| 276 | + of_node_put(child); |
|---|
| 277 | + of_dev_put(child_pdev); |
|---|
| 276 | 278 | |
|---|
| 277 | 279 | /* |
|---|
| 278 | 280 | * Configure the USB port as device or host according to the static |
|---|
| .. | .. |
|---|
| 292 | 294 | platform_set_drvdata(pdev, dwc3_data); |
|---|
| 293 | 295 | return 0; |
|---|
| 294 | 296 | |
|---|
| 297 | +err_node_put: |
|---|
| 298 | + of_node_put(child); |
|---|
| 295 | 299 | undo_softreset: |
|---|
| 296 | 300 | reset_control_assert(dwc3_data->rstc_rst); |
|---|
| 297 | 301 | undo_powerdown: |
|---|