linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Lucas Stach <l.stach@pengutronix.de>,
	Fugang Duan <B38611@freescale.com>,
	"David S. Miller" <davem@davemloft.net>,
	Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH 3.18 06/21] net: fec: introduce fec_ptp_stop and use in probe fail path
Date: Fri,  9 Mar 2018 16:18:28 -0800	[thread overview]
Message-ID: <20180310001801.425145519@linuxfoundation.org> (raw)
In-Reply-To: <20180310001801.045114869@linuxfoundation.org>

3.18-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lucas Stach <l.stach@pengutronix.de>

commit 32cba57ba74be58589aeb4cb6496183e46a5e3e5 upstream.

This function frees resources and cancels delayed work item that
have been initialized in fec_ptp_init().

Use this to do proper error handling if something goes wrong in
probe function after fec_ptp_init has been called.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[groeck: backport: context changes in .../fec_main.c]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/ethernet/freescale/fec.h      |    1 +
 drivers/net/ethernet/freescale/fec_main.c |    5 ++---
 drivers/net/ethernet/freescale/fec_ptp.c  |   10 ++++++++++
 3 files changed, 13 insertions(+), 3 deletions(-)

--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -546,6 +546,7 @@ struct fec_enet_private {
 };
 
 void fec_ptp_init(struct platform_device *pdev);
+void fec_ptp_stop(struct platform_device *pdev);
 void fec_ptp_start_cyclecounter(struct net_device *ndev);
 int fec_ptp_set(struct net_device *ndev, struct ifreq *ifr);
 int fec_ptp_get(struct net_device *ndev, struct ifreq *ifr);
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -3312,6 +3312,7 @@ failed_register:
 failed_mii_init:
 failed_irq:
 failed_init:
+	fec_ptp_stop(pdev);
 	if (fep->reg_phy)
 		regulator_disable(fep->reg_phy);
 failed_regulator:
@@ -3331,14 +3332,12 @@ fec_drv_remove(struct platform_device *p
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct fec_enet_private *fep = netdev_priv(ndev);
 
-	cancel_delayed_work_sync(&fep->time_keep);
 	cancel_work_sync(&fep->tx_timeout_work);
+	fec_ptp_stop(pdev);
 	unregister_netdev(ndev);
 	fec_enet_mii_remove(fep);
 	if (fep->reg_phy)
 		regulator_disable(fep->reg_phy);
-	if (fep->ptp_clock)
-		ptp_clock_unregister(fep->ptp_clock);
 	fec_enet_clk_enable(ndev, false);
 	of_node_put(fep->phy_node);
 	free_netdev(ndev);
--- a/drivers/net/ethernet/freescale/fec_ptp.c
+++ b/drivers/net/ethernet/freescale/fec_ptp.c
@@ -620,6 +620,16 @@ void fec_ptp_init(struct platform_device
 	schedule_delayed_work(&fep->time_keep, HZ);
 }
 
+void fec_ptp_stop(struct platform_device *pdev)
+{
+	struct net_device *ndev = platform_get_drvdata(pdev);
+	struct fec_enet_private *fep = netdev_priv(ndev);
+
+	cancel_delayed_work_sync(&fep->time_keep);
+	if (fep->ptp_clock)
+		ptp_clock_unregister(fep->ptp_clock);
+}
+
 /**
  * fec_ptp_check_pps_event
  * @fep: the fec_enet_private structure handle

  parent reply	other threads:[~2018-03-10  0:18 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-10  0:18 [PATCH 3.18 00/21] 3.18.99-stable review Greg Kroah-Hartman
2018-03-10  0:18 ` [PATCH 3.18 01/21] tpm_i2c_infineon: fix potential buffer overruns caused by bit glitches on the bus Greg Kroah-Hartman
2018-03-10  0:18 ` [PATCH 3.18 02/21] tpm_i2c_nuvoton: " Greg Kroah-Hartman
2018-03-10  0:18 ` [PATCH 3.18 03/21] ALSA: usb-audio: Add a quirck for B&W PX headphones Greg Kroah-Hartman
2018-03-10  0:18 ` [PATCH 3.18 04/21] cpufreq: s3c24xx: Fix broken s3c_cpufreq_init() Greg Kroah-Hartman
2018-03-10  0:18 ` [PATCH 3.18 05/21] ARM: mvebu: Fix broken PL310_ERRATA_753970 selects Greg Kroah-Hartman
2018-03-10  0:18 ` Greg Kroah-Hartman [this message]
2018-03-10  0:18 ` [PATCH 3.18 07/21] leds: do not overflow sysfs buffer in led_trigger_show Greg Kroah-Hartman
2018-03-10  0:18 ` [PATCH 3.18 08/21] bridge: check brport attr show in brport_show Greg Kroah-Hartman
2018-03-10  0:18 ` [PATCH 3.18 09/21] hdlc_ppp: carrier detect ok, dont turn off negotiation Greg Kroah-Hartman
2018-03-10  0:18 ` [PATCH 3.18 10/21] ipv6 sit: work around bogus gcc-8 -Wrestrict warning Greg Kroah-Hartman
2018-03-10  0:18 ` [PATCH 3.18 11/21] net: fix race on decreasing number of TX queues Greg Kroah-Hartman
2018-03-10  0:18 ` [PATCH 3.18 12/21] netlink: ensure to loop over all netns in genlmsg_multicast_allns() Greg Kroah-Hartman
2018-03-10  0:18 ` [PATCH 3.18 13/21] ppp: prevent unregistered channels from connecting to PPP units Greg Kroah-Hartman
2018-03-10  0:18 ` [PATCH 3.18 14/21] udplite: fix partial checksum initialization Greg Kroah-Hartman
2018-03-10  0:18 ` [PATCH 3.18 15/21] sctp: fix dst refcnt leak in sctp_v6_get_dst() Greg Kroah-Hartman
2018-03-10  0:18 ` [PATCH 3.18 16/21] s390/qeth: fix SETIP command handling Greg Kroah-Hartman
2018-03-10  0:18 ` [PATCH 3.18 17/21] s390/qeth: fix IPA command submission race Greg Kroah-Hartman
2018-03-10  0:18 ` [PATCH 3.18 18/21] sctp: verify size of a new chunk in _sctp_make_chunk() Greg Kroah-Hartman
2018-03-10  0:18 ` [PATCH 3.18 19/21] net: ipv4: dont allow setting net.ipv4.route.min_pmtu below 68 Greg Kroah-Hartman
2018-03-10  0:18 ` [PATCH 3.18 20/21] fib_semantics: Dont match route with mismatching tclassid Greg Kroah-Hartman
2018-03-10  0:18 ` [PATCH 3.18 21/21] dm io: fix duplicate bio completion due to missing ref count Greg Kroah-Hartman
2018-03-10  5:17 ` [PATCH 3.18 00/21] 3.18.99-stable review Shuah Khan
2018-03-10  6:19 ` kernelci.org bot
2018-03-10 15:42 ` Guenter Roeck
2018-03-10 15:51 ` Harsh Shandilya
2018-03-10 19:48   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180310001801.425145519@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=B38611@freescale.com \
    --cc=davem@davemloft.net \
    --cc=l.stach@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).