lkml.org 
[lkml]   [2019]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 3/3] net: ethernet: add ag71xx driver
From
From: Oleksij Rempel <o.rempel@pengutronix.de>
Date: Thu, 18 Apr 2019 07:26:20 +0200

> +static int ag71xx_remove(struct platform_device *pdev)
> +{
> + struct net_device *ndev = platform_get_drvdata(pdev);
> + struct ag71xx *ag;
> +
> + if (!ndev)
> + return 0;
> +
> + ag = netdev_priv(ndev);
> + ag71xx_phy_disconnect(ag);
> + ag71xx_mdio_remove(ag);
> + unregister_netdev(ndev);
> + platform_set_drvdata(pdev, NULL);
> +
> + return 0;
> +}

You should unregister the netdev before you disconnect the PHY and remove
the MDIO.

Also you need to call free_netdev() afterwards otherwise you will leak it.

\
 
 \ /
  Last update: 2019-04-19 23:36    [W:0.072 / U:0.756 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site