@@ -41,7 +41,6 @@ static int host1x_subdev_add(struct host1x_device *device,
41
41
struct device_node * np )
42
42
{
43
43
struct host1x_subdev * subdev ;
44
- struct device_node * child ;
45
44
int err ;
46
45
47
46
subdev = kzalloc (sizeof (* subdev ), GFP_KERNEL );
@@ -56,13 +55,12 @@ static int host1x_subdev_add(struct host1x_device *device,
56
55
mutex_unlock (& device -> subdevs_lock );
57
56
58
57
/* recursively add children */
59
- for_each_child_of_node (np , child ) {
58
+ for_each_child_of_node_scoped (np , child ) {
60
59
if (of_match_node (driver -> subdevs , child ) &&
61
60
of_device_is_available (child )) {
62
61
err = host1x_subdev_add (device , driver , child );
63
62
if (err < 0 ) {
64
63
/* XXX cleanup? */
65
- of_node_put (child );
66
64
return err ;
67
65
}
68
66
}
@@ -90,17 +88,14 @@ static void host1x_subdev_del(struct host1x_subdev *subdev)
90
88
static int host1x_device_parse_dt (struct host1x_device * device ,
91
89
struct host1x_driver * driver )
92
90
{
93
- struct device_node * np ;
94
91
int err ;
95
92
96
- for_each_child_of_node (device -> dev .parent -> of_node , np ) {
93
+ for_each_child_of_node_scoped (device -> dev .parent -> of_node , np ) {
97
94
if (of_match_node (driver -> subdevs , np ) &&
98
95
of_device_is_available (np )) {
99
96
err = host1x_subdev_add (device , driver , np );
100
- if (err < 0 ) {
101
- of_node_put (np );
97
+ if (err < 0 )
102
98
return err ;
103
- }
104
99
}
105
100
}
106
101
0 commit comments