@@ -113,11 +113,10 @@ static const struct phy_ops cygnus_pcie_phy_ops = {
113
113
static int cygnus_pcie_phy_probe (struct platform_device * pdev )
114
114
{
115
115
struct device * dev = & pdev -> dev ;
116
- struct device_node * node = dev -> of_node , * child ;
116
+ struct device_node * node = dev -> of_node ;
117
117
struct cygnus_pcie_phy_core * core ;
118
118
struct phy_provider * provider ;
119
119
unsigned cnt = 0 ;
120
- int ret ;
121
120
122
121
if (of_get_child_count (node ) == 0 ) {
123
122
dev_err (dev , "PHY no child node\n" );
@@ -136,35 +135,31 @@ static int cygnus_pcie_phy_probe(struct platform_device *pdev)
136
135
137
136
mutex_init (& core -> lock );
138
137
139
- for_each_available_child_of_node (node , child ) {
138
+ for_each_available_child_of_node_scoped (node , child ) {
140
139
unsigned int id ;
141
140
struct cygnus_pcie_phy * p ;
142
141
143
142
if (of_property_read_u32 (child , "reg" , & id )) {
144
143
dev_err (dev , "missing reg property for %pOFn\n" ,
145
144
child );
146
- ret = - EINVAL ;
147
- goto put_child ;
145
+ return - EINVAL ;
148
146
}
149
147
150
148
if (id >= MAX_NUM_PHYS ) {
151
149
dev_err (dev , "invalid PHY id: %u\n" , id );
152
- ret = - EINVAL ;
153
- goto put_child ;
150
+ return - EINVAL ;
154
151
}
155
152
156
153
if (core -> phys [id ].phy ) {
157
154
dev_err (dev , "duplicated PHY id: %u\n" , id );
158
- ret = - EINVAL ;
159
- goto put_child ;
155
+ return - EINVAL ;
160
156
}
161
157
162
158
p = & core -> phys [id ];
163
159
p -> phy = devm_phy_create (dev , child , & cygnus_pcie_phy_ops );
164
160
if (IS_ERR (p -> phy )) {
165
161
dev_err (dev , "failed to create PHY\n" );
166
- ret = PTR_ERR (p -> phy );
167
- goto put_child ;
162
+ return PTR_ERR (p -> phy );
168
163
}
169
164
170
165
p -> core = core ;
@@ -184,9 +179,6 @@ static int cygnus_pcie_phy_probe(struct platform_device *pdev)
184
179
dev_dbg (dev , "registered %u PCIe PHY(s)\n" , cnt );
185
180
186
181
return 0 ;
187
- put_child :
188
- of_node_put (child );
189
- return ret ;
190
182
}
191
183
192
184
static const struct of_device_id cygnus_pcie_phy_match_table [] = {
0 commit comments