@@ -104,9 +104,8 @@ static int dwmac1000_validate_ucast_entries(int ucast_entries)
104
104
* this function is to read the driver parameters from device-tree and
105
105
* set some private fields that will be used by the main at runtime.
106
106
*/
107
- static int stmmac_probe_config_dt (struct platform_device * pdev ,
108
- struct plat_stmmacenet_data * * plat_dat ,
109
- const char * * mac )
107
+ static struct plat_stmmacenet_data *
108
+ stmmac_probe_config_dt (struct platform_device * pdev , const char * * mac )
110
109
{
111
110
struct device_node * np = pdev -> dev .of_node ;
112
111
struct plat_stmmacenet_data * plat ;
@@ -115,9 +114,7 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
115
114
116
115
plat = devm_kzalloc (& pdev -> dev , sizeof (* plat ), GFP_KERNEL );
117
116
if (!plat )
118
- return - ENOMEM ;
119
-
120
- * plat_dat = plat ;
117
+ return ERR_PTR (- ENOMEM );
121
118
122
119
data = of_device_get_match_data (& pdev -> dev );
123
120
if (data ) {
@@ -156,7 +153,7 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
156
153
/* If phy-handle is not specified, check if we have a fixed-phy */
157
154
if (!plat -> phy_node && of_phy_is_fixed_link (np )) {
158
155
if ((of_phy_register_fixed_link (np ) < 0 ))
159
- return - ENODEV ;
156
+ return ERR_PTR ( - ENODEV ) ;
160
157
161
158
plat -> phy_node = of_node_get (np );
162
159
}
@@ -233,7 +230,7 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
233
230
GFP_KERNEL );
234
231
if (!dma_cfg ) {
235
232
of_node_put (np );
236
- return - ENOMEM ;
233
+ return ERR_PTR ( - ENOMEM ) ;
237
234
}
238
235
plat -> dma_cfg = dma_cfg ;
239
236
of_property_read_u32 (np , "snps,pbl" , & dma_cfg -> pbl );
@@ -251,14 +248,13 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
251
248
pr_warn ("force_sf_dma_mode is ignored if force_thresh_dma_mode is set." );
252
249
}
253
250
254
- return 0 ;
251
+ return plat ;
255
252
}
256
253
#else
257
- static int stmmac_probe_config_dt (struct platform_device * pdev ,
258
- struct plat_stmmacenet_data * * plat ,
259
- const char * * mac )
254
+ static struct plat_stmmacenet_data *
255
+ stmmac_probe_config_dt (struct platform_device * pdev , const char * * mac )
260
256
{
261
- return - ENOSYS ;
257
+ return ERR_PTR ( - ENOSYS ) ;
262
258
}
263
259
#endif /* CONFIG_OF */
264
260
@@ -325,10 +321,10 @@ int stmmac_pltfr_probe(struct platform_device *pdev)
325
321
return ret ;
326
322
327
323
if (pdev -> dev .of_node ) {
328
- ret = stmmac_probe_config_dt (pdev , & plat_dat , & stmmac_res .mac );
329
- if (ret ) {
324
+ plat_dat = stmmac_probe_config_dt (pdev , & stmmac_res .mac );
325
+ if (IS_ERR ( plat_dat ) ) {
330
326
dev_err (& pdev -> dev , "dt configuration failed\n" );
331
- return ret ;
327
+ return PTR_ERR ( plat_dat ) ;
332
328
}
333
329
} else {
334
330
plat_dat = dev_get_platdata (& pdev -> dev );
0 commit comments