Netdev List
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>,
	Richard Cochran <richardcochran@gmail.com>
Subject: Re: [PATCH net-next] net: dsa: mv88e6xxx: clean up PTP clock during setup failure
Date: Tue, 16 Sep 2025 11:03:47 +0300	[thread overview]
Message-ID: <20250916080347.es66wv7esea6v4oc@skbuf> (raw)
In-Reply-To: <E1uy84w-00000005Spi-46iF@rmk-PC.armlinux.org.uk> <E1uy84w-00000005Spi-46iF@rmk-PC.armlinux.org.uk>

On Mon, Sep 15, 2025 at 01:13:06PM +0100, Russell King (Oracle) wrote:
> If an error occurs during mv88e6xxx_setup() and the PTP clock has been
> registered, the clock will not be unregistered as mv88e6xxx_ptp_free()
> will not be called. mv88e6xxx_hwtstamp_free() also is not called.
> 
> As mv88e6xxx_ptp_free() can cope with being called without a successful
> call to mv88e6xxx_ptp_setup(), and mv88e6xxx_hwtstamp_free() is empty,
> add both these *_free() calls to the error cleanup paths in
> mv88e6xxx_setup().
> 
> Moreover, mv88e6xxx_teardown() should teardown setup done in
> mv88e6xxx_setup() - see dsa_switch_setup(). However, instead *_free()
> are called from mv88e6xxx_remove() function that is only called when a
> device is unbound, which omits cleanup should a failure occur later in
> dsa_switch_setup(). Move the *_free() calls from mv88e6xxx_remove() to
> mv88e6xxx_teardown().
> 
> Note that mv88e6xxx_ptp_setup() must be called holding the reg_lock,
> but mv88e6xxx_ptp_free() must never be. This is especially true after
> commit "ptp: rework ptp_clock_unregister() to disable events". This
> patch does not change this, but adds a comment to that effect.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

  reply	other threads:[~2025-09-16  8:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-15 12:13 [PATCH net-next] net: dsa: mv88e6xxx: clean up PTP clock during setup failure Russell King (Oracle)
2025-09-16  8:03 ` Vladimir Oltean [this message]
2025-09-16 23:40 ` patchwork-bot+netdevbpf

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=20250916080347.es66wv7esea6v4oc@skbuf \
    --to=olteanv@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=rmk+kernel@armlinux.org.uk \
    /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