@@ -3053,7 +3053,7 @@ static int emac_probe(struct platform_device *ofdev)
3053
3053
3054
3054
/* Allocate our net_device structure */
3055
3055
err = - ENOMEM ;
3056
- ndev = alloc_etherdev ( sizeof (struct emac_instance ));
3056
+ ndev = devm_alloc_etherdev ( & ofdev -> dev , sizeof (struct emac_instance ));
3057
3057
if (!ndev )
3058
3058
goto err_gone ;
3059
3059
@@ -3072,15 +3072,15 @@ static int emac_probe(struct platform_device *ofdev)
3072
3072
/* Init various config data based on device-tree */
3073
3073
err = emac_init_config (dev );
3074
3074
if (err )
3075
- goto err_free ;
3075
+ goto err_gone ;
3076
3076
3077
3077
/* Get interrupts. EMAC irq is mandatory, WOL irq is optional */
3078
3078
dev -> emac_irq = irq_of_parse_and_map (np , 0 );
3079
3079
dev -> wol_irq = irq_of_parse_and_map (np , 1 );
3080
3080
if (!dev -> emac_irq ) {
3081
3081
printk (KERN_ERR "%pOF: Can't map main interrupt\n" , np );
3082
3082
err = - ENODEV ;
3083
- goto err_free ;
3083
+ goto err_gone ;
3084
3084
}
3085
3085
ndev -> irq = dev -> emac_irq ;
3086
3086
@@ -3239,8 +3239,6 @@ static int emac_probe(struct platform_device *ofdev)
3239
3239
irq_dispose_mapping (dev -> wol_irq );
3240
3240
if (dev -> emac_irq )
3241
3241
irq_dispose_mapping (dev -> emac_irq );
3242
- err_free :
3243
- free_netdev (ndev );
3244
3242
err_gone :
3245
3243
/* if we were on the bootlist, remove us as we won't show up and
3246
3244
* wake up all waiters to notify them in case they were waiting
@@ -3289,7 +3287,6 @@ static void emac_remove(struct platform_device *ofdev)
3289
3287
if (dev -> emac_irq )
3290
3288
irq_dispose_mapping (dev -> emac_irq );
3291
3289
3292
- free_netdev (dev -> ndev );
3293
3290
}
3294
3291
3295
3292
/* XXX Features in here should be replaced by properties... */
0 commit comments