[PATCH v2 net,stable 1/2] net: fec: restore dev_id in the cases of probe error
The static variable dev_id always plus one before netdev registerred. It should restore the dev_id value in the cases of probe error. Signed-off-by: Fugang Duan --- drivers/net/ethernet/freescale/fec_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index e17d10b..dae89bc 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -3576,6 +3576,7 @@ static int fec_enet_get_irq_cnt(struct platform_device *pdev) of_node_put(phy_node); failed_ioremap: free_netdev(ndev); + dev_id--; return ret; } -- 1.9.1
Re: [PATCH v2 net,stable 1/2] net: fec: restore dev_id in the cases of probe error
On 1/2/2018 6:39 PM, Fugang Duan wrote: > The static variable dev_id always plus one before netdev registerred. > It should restore the dev_id value in the cases of probe error. > > Signed-off-by: Fugang Duan > --- > drivers/net/ethernet/freescale/fec_main.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/ethernet/freescale/fec_main.c > b/drivers/net/ethernet/freescale/fec_main.c > index e17d10b..dae89bc 100644 > --- a/drivers/net/ethernet/freescale/fec_main.c > +++ b/drivers/net/ethernet/freescale/fec_main.c > @@ -3576,6 +3576,7 @@ static int fec_enet_get_irq_cnt(struct platform_device > *pdev) > of_node_put(phy_node); > failed_ioremap: > free_netdev(ndev); > + dev_id--; This should be before failed_ioremap. > > return ret; > } >