@@ -104,9 +104,8 @@ static int dwmac1000_validate_ucast_entries(int ucast_entries)
104104 * this function is to read the driver parameters from device-tree and
105105 * set some private fields that will be used by the main at runtime.
106106 */
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 )
110109{
111110 struct device_node * np = pdev -> dev .of_node ;
112111 struct plat_stmmacenet_data * plat ;
@@ -115,9 +114,7 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
115114
116115 plat = devm_kzalloc (& pdev -> dev , sizeof (* plat ), GFP_KERNEL );
117116 if (!plat )
118- return - ENOMEM ;
119-
120- * plat_dat = plat ;
117+ return ERR_PTR (- ENOMEM );
121118
122119 data = of_device_get_match_data (& pdev -> dev );
123120 if (data ) {
@@ -156,7 +153,7 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
156153 /* If phy-handle is not specified, check if we have a fixed-phy */
157154 if (!plat -> phy_node && of_phy_is_fixed_link (np )) {
158155 if ((of_phy_register_fixed_link (np ) < 0 ))
159- return - ENODEV ;
156+ return ERR_PTR ( - ENODEV ) ;
160157
161158 plat -> phy_node = of_node_get (np );
162159 }
@@ -233,7 +230,7 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
233230 GFP_KERNEL );
234231 if (!dma_cfg ) {
235232 of_node_put (np );
236- return - ENOMEM ;
233+ return ERR_PTR ( - ENOMEM ) ;
237234 }
238235 plat -> dma_cfg = dma_cfg ;
239236 of_property_read_u32 (np , "snps,pbl" , & dma_cfg -> pbl );
@@ -251,14 +248,13 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
251248 pr_warn ("force_sf_dma_mode is ignored if force_thresh_dma_mode is set." );
252249 }
253250
254- return 0 ;
251+ return plat ;
255252}
256253#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 )
260256{
261- return - ENOSYS ;
257+ return ERR_PTR ( - ENOSYS ) ;
262258}
263259#endif /* CONFIG_OF */
264260
@@ -325,10 +321,10 @@ int stmmac_pltfr_probe(struct platform_device *pdev)
325321 return ret ;
326322
327323 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 ) ) {
330326 dev_err (& pdev -> dev , "dt configuration failed\n" );
331- return ret ;
327+ return PTR_ERR ( plat_dat ) ;
332328 }
333329 } else {
334330 plat_dat = dev_get_platdata (& pdev -> dev );
0 commit comments