forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/usb/dwc3/dwc3-st.c
....@@ -206,8 +206,8 @@
206206 if (!dwc3_data)
207207 return -ENOMEM;
208208
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");
211211 if (IS_ERR(dwc3_data->glue_base))
212212 return PTR_ERR(dwc3_data->glue_base);
213213
....@@ -255,24 +255,26 @@
255255 if (!child) {
256256 dev_err(&pdev->dev, "failed to find dwc3 core node\n");
257257 ret = -ENODEV;
258
- goto undo_softreset;
258
+ goto err_node_put;
259259 }
260260
261261 /* Allocate and initialize the core */
262262 ret = of_platform_populate(node, NULL, NULL, dev);
263263 if (ret) {
264264 dev_err(dev, "failed to add dwc3 core\n");
265
- goto undo_softreset;
265
+ goto err_node_put;
266266 }
267267
268268 child_pdev = of_find_device_by_node(child);
269269 if (!child_pdev) {
270270 dev_err(dev, "failed to find dwc3 core device\n");
271271 ret = -ENODEV;
272
- goto undo_softreset;
272
+ goto err_node_put;
273273 }
274274
275275 dwc3_data->dr_mode = usb_get_dr_mode(&child_pdev->dev);
276
+ of_node_put(child);
277
+ of_dev_put(child_pdev);
276278
277279 /*
278280 * Configure the USB port as device or host according to the static
....@@ -292,6 +294,8 @@
292294 platform_set_drvdata(pdev, dwc3_data);
293295 return 0;
294296
297
+err_node_put:
298
+ of_node_put(child);
295299 undo_softreset:
296300 reset_control_assert(dwc3_data->rstc_rst);
297301 undo_powerdown: