forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/arch/arm/mach-mvebu/pm-board.c
....@@ -79,7 +79,7 @@
7979 static int __init mvebu_armada_pm_init(void)
8080 {
8181 struct device_node *np;
82
- struct device_node *gpio_ctrl_np;
82
+ struct device_node *gpio_ctrl_np = NULL;
8383 int ret = 0, i;
8484
8585 if (!of_machine_is_compatible("marvell,axp-gp"))
....@@ -126,18 +126,23 @@
126126 goto out;
127127 }
128128
129
+ if (gpio_ctrl_np)
130
+ of_node_put(gpio_ctrl_np);
129131 gpio_ctrl_np = args.np;
130132 pic_raw_gpios[i] = args.args[0];
131133 }
132134
133135 gpio_ctrl = of_iomap(gpio_ctrl_np, 0);
134
- if (!gpio_ctrl)
135
- return -ENOMEM;
136
+ if (!gpio_ctrl) {
137
+ ret = -ENOMEM;
138
+ goto out;
139
+ }
136140
137141 mvebu_pm_suspend_init(mvebu_armada_pm_enter);
138142
139143 out:
140144 of_node_put(np);
145
+ of_node_put(gpio_ctrl_np);
141146 return ret;
142147 }
143148