@@ -33,8 +33,11 @@ static void __init of_sama5d2_clk_audio_pll_frac_setup(struct device_node *np)
3333 const char * name = np -> name ;
3434 const char * parent_name ;
3535 struct regmap * regmap ;
36+ struct device_node * parent_np ;
3637
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 );
3841 if (IS_ERR (regmap ))
3942 return ;
4043
@@ -56,8 +59,11 @@ static void __init of_sama5d2_clk_audio_pll_pad_setup(struct device_node *np)
5659 const char * name = np -> name ;
5760 const char * parent_name ;
5861 struct regmap * regmap ;
62+ struct device_node * parent_np ;
5963
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 );
6167 if (IS_ERR (regmap ))
6268 return ;
6369
@@ -79,8 +85,11 @@ static void __init of_sama5d2_clk_audio_pll_pmc_setup(struct device_node *np)
7985 const char * name = np -> name ;
8086 const char * parent_name ;
8187 struct regmap * regmap ;
88+ struct device_node * parent_np ;
8289
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 );
8493 if (IS_ERR (regmap ))
8594 return ;
8695
@@ -120,7 +129,7 @@ static void __init of_sama5d2_clk_generated_setup(struct device_node *np)
120129 struct clk_hw * hw ;
121130 unsigned int num_parents ;
122131 const char * parent_names [GENERATED_SOURCE_MAX ];
123- struct device_node * gcknp ;
132+ struct device_node * gcknp , * parent_np ;
124133 struct clk_range range = CLK_RANGE (0 , 0 );
125134 struct regmap * regmap ;
126135
@@ -134,7 +143,9 @@ static void __init of_sama5d2_clk_generated_setup(struct device_node *np)
134143 if (!num || num > PERIPHERAL_MAX )
135144 return ;
136145
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 );
138149 if (IS_ERR (regmap ))
139150 return ;
140151
@@ -180,8 +191,11 @@ static void __init of_sama5d4_clk_h32mx_setup(struct device_node *np)
180191 const char * name = np -> name ;
181192 const char * parent_name ;
182193 struct regmap * regmap ;
194+ struct device_node * parent_np ;
183195
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 );
185199 if (IS_ERR (regmap ))
186200 return ;
187201
@@ -243,12 +257,15 @@ static void __init of_at91rm9200_clk_main_osc_setup(struct device_node *np)
243257 const char * parent_name ;
244258 struct regmap * regmap ;
245259 bool bypass ;
260+ struct device_node * parent_np ;
246261
247262 of_property_read_string (np , "clock-output-names" , & name );
248263 bypass = of_property_read_bool (np , "atmel,osc-bypass" );
249264 parent_name = of_clk_get_parent_name (np , 0 );
250265
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 );
252269 if (IS_ERR (regmap ))
253270 return ;
254271
@@ -268,12 +285,15 @@ static void __init of_at91sam9x5_clk_main_rc_osc_setup(struct device_node *np)
268285 u32 accuracy = 0 ;
269286 const char * name = np -> name ;
270287 struct regmap * regmap ;
288+ struct device_node * parent_np ;
271289
272290 of_property_read_string (np , "clock-output-names" , & name );
273291 of_property_read_u32 (np , "clock-frequency" , & frequency );
274292 of_property_read_u32 (np , "clock-accuracy" , & accuracy );
275293
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 );
277297 if (IS_ERR (regmap ))
278298 return ;
279299
@@ -292,11 +312,14 @@ static void __init of_at91rm9200_clk_main_setup(struct device_node *np)
292312 const char * parent_name ;
293313 const char * name = np -> name ;
294314 struct regmap * regmap ;
315+ struct device_node * parent_np ;
295316
296317 parent_name = of_clk_get_parent_name (np , 0 );
297318 of_property_read_string (np , "clock-output-names" , & name );
298319
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 );
300323 if (IS_ERR (regmap ))
301324 return ;
302325
@@ -316,13 +339,16 @@ static void __init of_at91sam9x5_clk_main_setup(struct device_node *np)
316339 unsigned int num_parents ;
317340 const char * name = np -> name ;
318341 struct regmap * regmap ;
342+ struct device_node * parent_np ;
319343
320344 num_parents = of_clk_get_parent_count (np );
321345 if (num_parents == 0 || num_parents > 2 )
322346 return ;
323347
324348 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 );
326352 if (IS_ERR (regmap ))
327353 return ;
328354
@@ -373,6 +399,7 @@ of_at91_clk_master_setup(struct device_node *np,
373399 const char * name = np -> name ;
374400 struct clk_master_characteristics * characteristics ;
375401 struct regmap * regmap ;
402+ struct device_node * parent_np ;
376403
377404 num_parents = of_clk_get_parent_count (np );
378405 if (num_parents == 0 || num_parents > MASTER_SOURCE_MAX )
@@ -386,7 +413,9 @@ of_at91_clk_master_setup(struct device_node *np,
386413 if (!characteristics )
387414 return ;
388415
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 );
390419 if (IS_ERR (regmap ))
391420 return ;
392421
@@ -433,6 +462,7 @@ of_at91_clk_periph_setup(struct device_node *np, u8 type)
433462 const char * name ;
434463 struct device_node * periphclknp ;
435464 struct regmap * regmap ;
465+ struct device_node * parent_np ;
436466
437467 parent_name = of_clk_get_parent_name (np , 0 );
438468 if (!parent_name )
@@ -442,7 +472,9 @@ of_at91_clk_periph_setup(struct device_node *np, u8 type)
442472 if (!num || num > PERIPHERAL_MAX )
443473 return ;
444474
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 );
446478 if (IS_ERR (regmap ))
447479 return ;
448480
@@ -601,6 +633,7 @@ of_at91_clk_pll_setup(struct device_node *np,
601633 struct regmap * regmap ;
602634 const char * parent_name ;
603635 const char * name = np -> name ;
636+ struct device_node * parent_np ;
604637 struct clk_pll_characteristics * characteristics ;
605638
606639 if (of_property_read_u32 (np , "reg" , & id ))
@@ -610,7 +643,9 @@ of_at91_clk_pll_setup(struct device_node *np,
610643
611644 of_property_read_string (np , "clock-output-names" , & name );
612645
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 );
614649 if (IS_ERR (regmap ))
615650 return ;
616651
@@ -665,12 +700,15 @@ of_at91sam9x5_clk_plldiv_setup(struct device_node *np)
665700 const char * parent_name ;
666701 const char * name = np -> name ;
667702 struct regmap * regmap ;
703+ struct device_node * parent_np ;
668704
669705 parent_name = of_clk_get_parent_name (np , 0 );
670706
671707 of_property_read_string (np , "clock-output-names" , & name );
672708
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 );
674712 if (IS_ERR (regmap ))
675713 return ;
676714
@@ -694,7 +732,7 @@ of_at91_clk_prog_setup(struct device_node *np,
694732 unsigned int num_parents ;
695733 const char * parent_names [PROG_SOURCE_MAX ];
696734 const char * name ;
697- struct device_node * progclknp ;
735+ struct device_node * progclknp , * parent_np ;
698736 struct regmap * regmap ;
699737
700738 num_parents = of_clk_get_parent_count (np );
@@ -707,7 +745,9 @@ of_at91_clk_prog_setup(struct device_node *np,
707745 if (!num || num > (PROG_ID_MAX + 1 ))
708746 return ;
709747
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 );
711751 if (IS_ERR (regmap ))
712752 return ;
713753
@@ -756,13 +796,16 @@ static void __init of_at91sam9260_clk_slow_setup(struct device_node *np)
756796 unsigned int num_parents ;
757797 const char * name = np -> name ;
758798 struct regmap * regmap ;
799+ struct device_node * parent_np ;
759800
760801 num_parents = of_clk_get_parent_count (np );
761802 if (num_parents != 2 )
762803 return ;
763804
764805 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 );
766809 if (IS_ERR (regmap ))
767810 return ;
768811
@@ -788,6 +831,7 @@ static void __init of_at91sam9x5_clk_smd_setup(struct device_node *np)
788831 const char * parent_names [SMD_SOURCE_MAX ];
789832 const char * name = np -> name ;
790833 struct regmap * regmap ;
834+ struct device_node * parent_np ;
791835
792836 num_parents = of_clk_get_parent_count (np );
793837 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)
797841
798842 of_property_read_string (np , "clock-output-names" , & name );
799843
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 );
801847 if (IS_ERR (regmap ))
802848 return ;
803849
@@ -818,15 +864,17 @@ static void __init of_at91rm9200_clk_sys_setup(struct device_node *np)
818864 u32 id ;
819865 struct clk_hw * hw ;
820866 const char * name ;
821- struct device_node * sysclknp ;
867+ struct device_node * sysclknp , * parent_np ;
822868 const char * parent_name ;
823869 struct regmap * regmap ;
824870
825871 num = of_get_child_count (np );
826872 if (num > (SYSTEM_MAX_ID + 1 ))
827873 return ;
828874
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 );
830878 if (IS_ERR (regmap ))
831879 return ;
832880
@@ -859,6 +907,7 @@ static void __init of_at91sam9x5_clk_usb_setup(struct device_node *np)
859907 const char * parent_names [USB_SOURCE_MAX ];
860908 const char * name = np -> name ;
861909 struct regmap * regmap ;
910+ struct device_node * parent_np ;
862911
863912 num_parents = of_clk_get_parent_count (np );
864913 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)
868917
869918 of_property_read_string (np , "clock-output-names" , & name );
870919
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 );
872923 if (IS_ERR (regmap ))
873924 return ;
874925
@@ -888,14 +939,17 @@ static void __init of_at91sam9n12_clk_usb_setup(struct device_node *np)
888939 const char * parent_name ;
889940 const char * name = np -> name ;
890941 struct regmap * regmap ;
942+ struct device_node * parent_np ;
891943
892944 parent_name = of_clk_get_parent_name (np , 0 );
893945 if (!parent_name )
894946 return ;
895947
896948 of_property_read_string (np , "clock-output-names" , & name );
897949
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 );
899953 if (IS_ERR (regmap ))
900954 return ;
901955
@@ -915,6 +969,7 @@ static void __init of_at91rm9200_clk_usb_setup(struct device_node *np)
915969 const char * name = np -> name ;
916970 u32 divisors [4 ] = {0 , 0 , 0 , 0 };
917971 struct regmap * regmap ;
972+ struct device_node * parent_np ;
918973
919974 parent_name = of_clk_get_parent_name (np , 0 );
920975 if (!parent_name )
@@ -926,7 +981,9 @@ static void __init of_at91rm9200_clk_usb_setup(struct device_node *np)
926981
927982 of_property_read_string (np , "clock-output-names" , & name );
928983
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 );
930987 if (IS_ERR (regmap ))
931988 return ;
932989 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)
9461003 const char * parent_name ;
9471004 const char * name = np -> name ;
9481005 struct regmap * regmap_pmc , * regmap_sfr ;
1006+ struct device_node * parent_np ;
9491007
9501008 parent_name = of_clk_get_parent_name (np , 0 );
9511009
9521010 of_property_read_string (np , "clock-output-names" , & name );
9531011
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 );
9551015 if (IS_ERR (regmap_pmc ))
9561016 return ;
9571017
0 commit comments