Skip to content

Commit 39eaf52

Browse files
javiercarrascocruzvireshk
authored andcommitted
cpufreq: dt-platdev: eliminate uses of of_node_put()
Make use of the __free() cleanup handler to automatically free nodes when they get out of scope. Signed-off-by: Javier Carrasco <[email protected]> Signed-off-by: Viresh Kumar <[email protected]>
1 parent 68090fd commit 39eaf52

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/cpufreq/cpufreq-dt-platdev.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,19 +198,18 @@ static const struct of_device_id blocklist[] __initconst = {
198198

199199
static bool __init cpu0_node_has_opp_v2_prop(void)
200200
{
201-
struct device_node *np = of_cpu_device_node_get(0);
201+
struct device_node *np __free(device_node) = of_cpu_device_node_get(0);
202202
bool ret = false;
203203

204204
if (of_property_present(np, "operating-points-v2"))
205205
ret = true;
206206

207-
of_node_put(np);
208207
return ret;
209208
}
210209

211210
static int __init cpufreq_dt_platdev_init(void)
212211
{
213-
struct device_node *np = of_find_node_by_path("/");
212+
struct device_node *np __free(device_node) = of_find_node_by_path("/");
214213
const struct of_device_id *match;
215214
const void *data = NULL;
216215

@@ -226,11 +225,9 @@ static int __init cpufreq_dt_platdev_init(void)
226225
if (cpu0_node_has_opp_v2_prop() && !of_match_node(blocklist, np))
227226
goto create_pdev;
228227

229-
of_node_put(np);
230228
return -ENODEV;
231229

232230
create_pdev:
233-
of_node_put(np);
234231
return PTR_ERR_OR_ZERO(platform_device_register_data(NULL, "cpufreq-dt",
235232
-1, data,
236233
sizeof(struct cpufreq_dt_platform_data)));

0 commit comments

Comments
 (0)