@@ -33,8 +33,11 @@ static void __init of_sama5d2_clk_audio_pll_frac_setup(struct device_node *np)
33
33
const char * name = np -> name ;
34
34
const char * parent_name ;
35
35
struct regmap * regmap ;
36
+ struct device_node * parent_np ;
36
37
37
- regmap = syscon_node_to_regmap (of_get_parent (np ));
38
+ parent_np = of_get_parent (np );
39
+ regmap = syscon_node_to_regmap (parent_np );
40
+ of_node_put (parent_np );
38
41
if (IS_ERR (regmap ))
39
42
return ;
40
43
@@ -56,8 +59,11 @@ static void __init of_sama5d2_clk_audio_pll_pad_setup(struct device_node *np)
56
59
const char * name = np -> name ;
57
60
const char * parent_name ;
58
61
struct regmap * regmap ;
62
+ struct device_node * parent_np ;
59
63
60
- regmap = syscon_node_to_regmap (of_get_parent (np ));
64
+ parent_np = of_get_parent (np );
65
+ regmap = syscon_node_to_regmap (parent_np );
66
+ of_node_put (parent_np );
61
67
if (IS_ERR (regmap ))
62
68
return ;
63
69
@@ -79,8 +85,11 @@ static void __init of_sama5d2_clk_audio_pll_pmc_setup(struct device_node *np)
79
85
const char * name = np -> name ;
80
86
const char * parent_name ;
81
87
struct regmap * regmap ;
88
+ struct device_node * parent_np ;
82
89
83
- regmap = syscon_node_to_regmap (of_get_parent (np ));
90
+ parent_np = of_get_parent (np );
91
+ regmap = syscon_node_to_regmap (parent_np );
92
+ of_node_put (parent_np );
84
93
if (IS_ERR (regmap ))
85
94
return ;
86
95
@@ -120,7 +129,7 @@ static void __init of_sama5d2_clk_generated_setup(struct device_node *np)
120
129
struct clk_hw * hw ;
121
130
unsigned int num_parents ;
122
131
const char * parent_names [GENERATED_SOURCE_MAX ];
123
- struct device_node * gcknp ;
132
+ struct device_node * gcknp , * parent_np ;
124
133
struct clk_range range = CLK_RANGE (0 , 0 );
125
134
struct regmap * regmap ;
126
135
@@ -134,7 +143,9 @@ static void __init of_sama5d2_clk_generated_setup(struct device_node *np)
134
143
if (!num || num > PERIPHERAL_MAX )
135
144
return ;
136
145
137
- regmap = syscon_node_to_regmap (of_get_parent (np ));
146
+ parent_np = of_get_parent (np );
147
+ regmap = syscon_node_to_regmap (parent_np );
148
+ of_node_put (parent_np );
138
149
if (IS_ERR (regmap ))
139
150
return ;
140
151
@@ -180,8 +191,11 @@ static void __init of_sama5d4_clk_h32mx_setup(struct device_node *np)
180
191
const char * name = np -> name ;
181
192
const char * parent_name ;
182
193
struct regmap * regmap ;
194
+ struct device_node * parent_np ;
183
195
184
- regmap = syscon_node_to_regmap (of_get_parent (np ));
196
+ parent_np = of_get_parent (np );
197
+ regmap = syscon_node_to_regmap (parent_np );
198
+ of_node_put (parent_np );
185
199
if (IS_ERR (regmap ))
186
200
return ;
187
201
@@ -243,12 +257,15 @@ static void __init of_at91rm9200_clk_main_osc_setup(struct device_node *np)
243
257
const char * parent_name ;
244
258
struct regmap * regmap ;
245
259
bool bypass ;
260
+ struct device_node * parent_np ;
246
261
247
262
of_property_read_string (np , "clock-output-names" , & name );
248
263
bypass = of_property_read_bool (np , "atmel,osc-bypass" );
249
264
parent_name = of_clk_get_parent_name (np , 0 );
250
265
251
- regmap = syscon_node_to_regmap (of_get_parent (np ));
266
+ parent_np = of_get_parent (np );
267
+ regmap = syscon_node_to_regmap (parent_np );
268
+ of_node_put (parent_np );
252
269
if (IS_ERR (regmap ))
253
270
return ;
254
271
@@ -268,12 +285,15 @@ static void __init of_at91sam9x5_clk_main_rc_osc_setup(struct device_node *np)
268
285
u32 accuracy = 0 ;
269
286
const char * name = np -> name ;
270
287
struct regmap * regmap ;
288
+ struct device_node * parent_np ;
271
289
272
290
of_property_read_string (np , "clock-output-names" , & name );
273
291
of_property_read_u32 (np , "clock-frequency" , & frequency );
274
292
of_property_read_u32 (np , "clock-accuracy" , & accuracy );
275
293
276
- regmap = syscon_node_to_regmap (of_get_parent (np ));
294
+ parent_np = of_get_parent (np );
295
+ regmap = syscon_node_to_regmap (parent_np );
296
+ of_node_put (parent_np );
277
297
if (IS_ERR (regmap ))
278
298
return ;
279
299
@@ -292,11 +312,14 @@ static void __init of_at91rm9200_clk_main_setup(struct device_node *np)
292
312
const char * parent_name ;
293
313
const char * name = np -> name ;
294
314
struct regmap * regmap ;
315
+ struct device_node * parent_np ;
295
316
296
317
parent_name = of_clk_get_parent_name (np , 0 );
297
318
of_property_read_string (np , "clock-output-names" , & name );
298
319
299
- regmap = syscon_node_to_regmap (of_get_parent (np ));
320
+ parent_np = of_get_parent (np );
321
+ regmap = syscon_node_to_regmap (parent_np );
322
+ of_node_put (parent_np );
300
323
if (IS_ERR (regmap ))
301
324
return ;
302
325
@@ -316,13 +339,16 @@ static void __init of_at91sam9x5_clk_main_setup(struct device_node *np)
316
339
unsigned int num_parents ;
317
340
const char * name = np -> name ;
318
341
struct regmap * regmap ;
342
+ struct device_node * parent_np ;
319
343
320
344
num_parents = of_clk_get_parent_count (np );
321
345
if (num_parents == 0 || num_parents > 2 )
322
346
return ;
323
347
324
348
of_clk_parent_fill (np , parent_names , num_parents );
325
- regmap = syscon_node_to_regmap (of_get_parent (np ));
349
+ parent_np = of_get_parent (np );
350
+ regmap = syscon_node_to_regmap (parent_np );
351
+ of_node_put (parent_np );
326
352
if (IS_ERR (regmap ))
327
353
return ;
328
354
@@ -373,6 +399,7 @@ of_at91_clk_master_setup(struct device_node *np,
373
399
const char * name = np -> name ;
374
400
struct clk_master_characteristics * characteristics ;
375
401
struct regmap * regmap ;
402
+ struct device_node * parent_np ;
376
403
377
404
num_parents = of_clk_get_parent_count (np );
378
405
if (num_parents == 0 || num_parents > MASTER_SOURCE_MAX )
@@ -386,7 +413,9 @@ of_at91_clk_master_setup(struct device_node *np,
386
413
if (!characteristics )
387
414
return ;
388
415
389
- regmap = syscon_node_to_regmap (of_get_parent (np ));
416
+ parent_np = of_get_parent (np );
417
+ regmap = syscon_node_to_regmap (parent_np );
418
+ of_node_put (parent_np );
390
419
if (IS_ERR (regmap ))
391
420
return ;
392
421
@@ -433,6 +462,7 @@ of_at91_clk_periph_setup(struct device_node *np, u8 type)
433
462
const char * name ;
434
463
struct device_node * periphclknp ;
435
464
struct regmap * regmap ;
465
+ struct device_node * parent_np ;
436
466
437
467
parent_name = of_clk_get_parent_name (np , 0 );
438
468
if (!parent_name )
@@ -442,7 +472,9 @@ of_at91_clk_periph_setup(struct device_node *np, u8 type)
442
472
if (!num || num > PERIPHERAL_MAX )
443
473
return ;
444
474
445
- regmap = syscon_node_to_regmap (of_get_parent (np ));
475
+ parent_np = of_get_parent (np );
476
+ regmap = syscon_node_to_regmap (parent_np );
477
+ of_node_put (parent_np );
446
478
if (IS_ERR (regmap ))
447
479
return ;
448
480
@@ -601,6 +633,7 @@ of_at91_clk_pll_setup(struct device_node *np,
601
633
struct regmap * regmap ;
602
634
const char * parent_name ;
603
635
const char * name = np -> name ;
636
+ struct device_node * parent_np ;
604
637
struct clk_pll_characteristics * characteristics ;
605
638
606
639
if (of_property_read_u32 (np , "reg" , & id ))
@@ -610,7 +643,9 @@ of_at91_clk_pll_setup(struct device_node *np,
610
643
611
644
of_property_read_string (np , "clock-output-names" , & name );
612
645
613
- regmap = syscon_node_to_regmap (of_get_parent (np ));
646
+ parent_np = of_get_parent (np );
647
+ regmap = syscon_node_to_regmap (parent_np );
648
+ of_node_put (parent_np );
614
649
if (IS_ERR (regmap ))
615
650
return ;
616
651
@@ -665,12 +700,15 @@ of_at91sam9x5_clk_plldiv_setup(struct device_node *np)
665
700
const char * parent_name ;
666
701
const char * name = np -> name ;
667
702
struct regmap * regmap ;
703
+ struct device_node * parent_np ;
668
704
669
705
parent_name = of_clk_get_parent_name (np , 0 );
670
706
671
707
of_property_read_string (np , "clock-output-names" , & name );
672
708
673
- regmap = syscon_node_to_regmap (of_get_parent (np ));
709
+ parent_np = of_get_parent (np );
710
+ regmap = syscon_node_to_regmap (parent_np );
711
+ of_node_put (parent_np );
674
712
if (IS_ERR (regmap ))
675
713
return ;
676
714
@@ -694,7 +732,7 @@ of_at91_clk_prog_setup(struct device_node *np,
694
732
unsigned int num_parents ;
695
733
const char * parent_names [PROG_SOURCE_MAX ];
696
734
const char * name ;
697
- struct device_node * progclknp ;
735
+ struct device_node * progclknp , * parent_np ;
698
736
struct regmap * regmap ;
699
737
700
738
num_parents = of_clk_get_parent_count (np );
@@ -707,7 +745,9 @@ of_at91_clk_prog_setup(struct device_node *np,
707
745
if (!num || num > (PROG_ID_MAX + 1 ))
708
746
return ;
709
747
710
- regmap = syscon_node_to_regmap (of_get_parent (np ));
748
+ parent_np = of_get_parent (np );
749
+ regmap = syscon_node_to_regmap (parent_np );
750
+ of_node_put (parent_np );
711
751
if (IS_ERR (regmap ))
712
752
return ;
713
753
@@ -756,13 +796,16 @@ static void __init of_at91sam9260_clk_slow_setup(struct device_node *np)
756
796
unsigned int num_parents ;
757
797
const char * name = np -> name ;
758
798
struct regmap * regmap ;
799
+ struct device_node * parent_np ;
759
800
760
801
num_parents = of_clk_get_parent_count (np );
761
802
if (num_parents != 2 )
762
803
return ;
763
804
764
805
of_clk_parent_fill (np , parent_names , num_parents );
765
- regmap = syscon_node_to_regmap (of_get_parent (np ));
806
+ parent_np = of_get_parent (np );
807
+ regmap = syscon_node_to_regmap (parent_np );
808
+ of_node_put (parent_np );
766
809
if (IS_ERR (regmap ))
767
810
return ;
768
811
@@ -788,6 +831,7 @@ static void __init of_at91sam9x5_clk_smd_setup(struct device_node *np)
788
831
const char * parent_names [SMD_SOURCE_MAX ];
789
832
const char * name = np -> name ;
790
833
struct regmap * regmap ;
834
+ struct device_node * parent_np ;
791
835
792
836
num_parents = of_clk_get_parent_count (np );
793
837
if (num_parents == 0 || num_parents > SMD_SOURCE_MAX )
@@ -797,7 +841,9 @@ static void __init of_at91sam9x5_clk_smd_setup(struct device_node *np)
797
841
798
842
of_property_read_string (np , "clock-output-names" , & name );
799
843
800
- regmap = syscon_node_to_regmap (of_get_parent (np ));
844
+ parent_np = of_get_parent (np );
845
+ regmap = syscon_node_to_regmap (parent_np );
846
+ of_node_put (parent_np );
801
847
if (IS_ERR (regmap ))
802
848
return ;
803
849
@@ -818,15 +864,17 @@ static void __init of_at91rm9200_clk_sys_setup(struct device_node *np)
818
864
u32 id ;
819
865
struct clk_hw * hw ;
820
866
const char * name ;
821
- struct device_node * sysclknp ;
867
+ struct device_node * sysclknp , * parent_np ;
822
868
const char * parent_name ;
823
869
struct regmap * regmap ;
824
870
825
871
num = of_get_child_count (np );
826
872
if (num > (SYSTEM_MAX_ID + 1 ))
827
873
return ;
828
874
829
- regmap = syscon_node_to_regmap (of_get_parent (np ));
875
+ parent_np = of_get_parent (np );
876
+ regmap = syscon_node_to_regmap (parent_np );
877
+ of_node_put (parent_np );
830
878
if (IS_ERR (regmap ))
831
879
return ;
832
880
@@ -859,6 +907,7 @@ static void __init of_at91sam9x5_clk_usb_setup(struct device_node *np)
859
907
const char * parent_names [USB_SOURCE_MAX ];
860
908
const char * name = np -> name ;
861
909
struct regmap * regmap ;
910
+ struct device_node * parent_np ;
862
911
863
912
num_parents = of_clk_get_parent_count (np );
864
913
if (num_parents == 0 || num_parents > USB_SOURCE_MAX )
@@ -868,7 +917,9 @@ static void __init of_at91sam9x5_clk_usb_setup(struct device_node *np)
868
917
869
918
of_property_read_string (np , "clock-output-names" , & name );
870
919
871
- regmap = syscon_node_to_regmap (of_get_parent (np ));
920
+ parent_np = of_get_parent (np );
921
+ regmap = syscon_node_to_regmap (parent_np );
922
+ of_node_put (parent_np );
872
923
if (IS_ERR (regmap ))
873
924
return ;
874
925
@@ -888,14 +939,17 @@ static void __init of_at91sam9n12_clk_usb_setup(struct device_node *np)
888
939
const char * parent_name ;
889
940
const char * name = np -> name ;
890
941
struct regmap * regmap ;
942
+ struct device_node * parent_np ;
891
943
892
944
parent_name = of_clk_get_parent_name (np , 0 );
893
945
if (!parent_name )
894
946
return ;
895
947
896
948
of_property_read_string (np , "clock-output-names" , & name );
897
949
898
- regmap = syscon_node_to_regmap (of_get_parent (np ));
950
+ parent_np = of_get_parent (np );
951
+ regmap = syscon_node_to_regmap (parent_np );
952
+ of_node_put (parent_np );
899
953
if (IS_ERR (regmap ))
900
954
return ;
901
955
@@ -915,6 +969,7 @@ static void __init of_at91rm9200_clk_usb_setup(struct device_node *np)
915
969
const char * name = np -> name ;
916
970
u32 divisors [4 ] = {0 , 0 , 0 , 0 };
917
971
struct regmap * regmap ;
972
+ struct device_node * parent_np ;
918
973
919
974
parent_name = of_clk_get_parent_name (np , 0 );
920
975
if (!parent_name )
@@ -926,7 +981,9 @@ static void __init of_at91rm9200_clk_usb_setup(struct device_node *np)
926
981
927
982
of_property_read_string (np , "clock-output-names" , & name );
928
983
929
- regmap = syscon_node_to_regmap (of_get_parent (np ));
984
+ parent_np = of_get_parent (np );
985
+ regmap = syscon_node_to_regmap (parent_np );
986
+ of_node_put (parent_np );
930
987
if (IS_ERR (regmap ))
931
988
return ;
932
989
hw = at91rm9200_clk_register_usb (regmap , name , parent_name , divisors );
@@ -946,12 +1003,15 @@ static void __init of_at91sam9x5_clk_utmi_setup(struct device_node *np)
946
1003
const char * parent_name ;
947
1004
const char * name = np -> name ;
948
1005
struct regmap * regmap_pmc , * regmap_sfr ;
1006
+ struct device_node * parent_np ;
949
1007
950
1008
parent_name = of_clk_get_parent_name (np , 0 );
951
1009
952
1010
of_property_read_string (np , "clock-output-names" , & name );
953
1011
954
- regmap_pmc = syscon_node_to_regmap (of_get_parent (np ));
1012
+ parent_np = of_get_parent (np );
1013
+ regmap_pmc = syscon_node_to_regmap (parent_np );
1014
+ of_node_put (parent_np );
955
1015
if (IS_ERR (regmap_pmc ))
956
1016
return ;
957
1017
0 commit comments