Commit f62457df authored by Matt Johnston's avatar Matt Johnston Committed by Jakub Kicinski
Browse files

mctp: Avoid warning if unregister notifies twice



Previously if an unregister notify handler ran twice (waiting for
netdev to be released) it would print a warning in mctp_unregister()
every subsequent time the unregister notify occured.

Instead we only need to worry about the case where a mctp_ptr is
set on an unknown device type.

Signed-off-by: default avatarMatt Johnston <matt@codeconstruct.com.au>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 23d74330
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -428,10 +428,10 @@ static void mctp_unregister(struct net_device *dev)
	struct mctp_dev *mdev;

	mdev = mctp_dev_get_rtnl(dev);
	if (mctp_known(dev) != (bool)mdev) {
	if (mdev && !mctp_known(dev)) {
		// Sanity check, should match what was set in mctp_register
		netdev_warn(dev, "%s: mdev pointer %d but type (%d) match is %d",
			    __func__, (bool)mdev, mctp_known(dev), dev->type);
		netdev_warn(dev, "%s: BUG mctp_ptr set for unknown type %d",
			    __func__, dev->type);
		return;
	}
	if (!mdev)
@@ -455,7 +455,7 @@ static int mctp_register(struct net_device *dev)

	if (mdev) {
		if (!mctp_known(dev))
			netdev_warn(dev, "%s: mctp_dev set for unknown type %d",
			netdev_warn(dev, "%s: BUG mctp_ptr set for unknown type %d",
				    __func__, dev->type);
		return 0;
	}