forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/pinctrl/spear/pinctrl-spear.c
....@@ -157,12 +157,16 @@
157157 /* calculate number of maps required */
158158 for_each_child_of_node(np_config, np) {
159159 ret = of_property_read_string(np, "st,function", &function);
160
- if (ret < 0)
160
+ if (ret < 0) {
161
+ of_node_put(np);
161162 return ret;
163
+ }
162164
163165 ret = of_property_count_strings(np, "st,pins");
164
- if (ret < 0)
166
+ if (ret < 0) {
167
+ of_node_put(np);
165168 return ret;
169
+ }
166170
167171 count += ret;
168172 }
....@@ -354,7 +358,6 @@
354358 struct spear_pinctrl_machdata *machdata)
355359 {
356360 struct device_node *np = pdev->dev.of_node;
357
- struct resource *res;
358361 struct spear_pmx *pmx;
359362
360363 if (!machdata)
....@@ -364,8 +367,7 @@
364367 if (!pmx)
365368 return -ENOMEM;
366369
367
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
368
- pmx->vbase = devm_ioremap_resource(&pdev->dev, res);
370
+ pmx->vbase = devm_platform_ioremap_resource(pdev, 0);
369371 if (IS_ERR(pmx->vbase))
370372 return PTR_ERR(pmx->vbase);
371373