Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5073223pxb; Mon, 15 Feb 2021 08:48:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJwzx9aXtCTd8jePAdmvucIu1ukCHShfKkBkoOdLIxI68OP0Jhxd9p8YPbWxRAN69jIaIRui X-Received: by 2002:a17:907:77cb:: with SMTP id kz11mr15982049ejc.12.1613407728658; Mon, 15 Feb 2021 08:48:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613407728; cv=none; d=google.com; s=arc-20160816; b=RXupNAIy2PJB+CE0uppjI0/Z1LL6MZFsu3rySgSfPcugC/4USrpboBJ2tXwEzf6iv3 bJ8hlAtP3AStNswO7XgQEjkBHIyuGJ4wfseii3+YhkRNakRrjngBFpFMwiOXV2qqr+cX Zkvzta3cCF+h0mugPa35trvBoiUJ0HJn1ZZSjCzIaiJ1qw3N7AI4GOStJNrDpplLG5YQ DufM53eyFrnHdPgD5SvIdqQWTY/d0ET6eO3r3A/+M9OYgFi6oFgvQKaDi2G99BTI8BWS /rfb4uw7DiOjdPcx14NEMyDkzMRu17eSz7WHqHx3tgxYvD/YR48GO1ouuOgM2jZuQoL4 CfSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PhZfc8DgQmw51V902AW7viV1Bjg+3EVRIcix+L1vS2o=; b=q+D+Bduh9TUzDjqDsimf+5eWvRQEQMwtdmnPjBMp/TqkxBaKsNbwKERGmjM9ArTkNM q96b52+F5bcvk08+1+AQ2rDxjIvtP9W5JI7ZoYmJfc2VWVbffz6HZniPmtQtJYBENzOP 4fWqQe7CX7PuaBkWwEm0UhsX/7ih9UVxooe5zoWvO1pnOFyYBsCgHR408x+f3QlIkbxs 861ZhZlMnNUIOLEKqJyXPirKnZoOPiSk3lwKWmF02ho3MvCItg1U0ODnwTE0Ow+jxPez 7h1udq+I1WvLm418pO5/kxl3GxdhdFOs0NEEO8IIhsTh/FdAs4nJjneMJs2DoCttPRv+ T9zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pehamaY8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rv26si12531291ejb.330.2021.02.15.08.48.23; Mon, 15 Feb 2021 08:48:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pehamaY8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231671AbhBOQrS (ORCPT + 99 others); Mon, 15 Feb 2021 11:47:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:50206 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230264AbhBOPiK (ORCPT ); Mon, 15 Feb 2021 10:38:10 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C141864EB3; Mon, 15 Feb 2021 15:34:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613403260; bh=EnWOnXA1k+EUBZHBNnXsQqN75JLJU7rDc1Gn2kQy/ao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pehamaY8/z/BkgTMXJqr/aU7fQCnfe0M+YwIKyirujNS2+XBAdplM/+P8XRq6pDXn tKCXZah98fnoAP6h4bJ7TsTe37SGZt6CN9TgTz1ybsK/sFpmrxvvedYvL+9BOsjPhr wKGq6klTjzF98JhXhH/4ukOYH+p6FmCieA23jEXs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Andrew Lunn , Florian Fainelli , Jakub Kicinski Subject: [PATCH 5.10 089/104] net: dsa: call teardown method on probe failure Date: Mon, 15 Feb 2021 16:27:42 +0100 Message-Id: <20210215152722.334188230@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210215152719.459796636@linuxfoundation.org> References: <20210215152719.459796636@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vladimir Oltean commit 8fd54a73b7cda11548154451bdb4bde6d8ff74c7 upstream. Since teardown is supposed to undo the effects of the setup method, it should be called in the error path for dsa_switch_setup, not just in dsa_switch_teardown. Fixes: 5e3f847a02aa ("net: dsa: Add teardown callback for drivers") Signed-off-by: Vladimir Oltean Reviewed-by: Andrew Lunn Reviewed-by: Florian Fainelli Link: https://lore.kernel.org/r/20210204163351.2929670-1-vladimir.oltean@nxp.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/dsa/dsa2.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -462,20 +462,23 @@ static int dsa_switch_setup(struct dsa_s ds->slave_mii_bus = devm_mdiobus_alloc(ds->dev); if (!ds->slave_mii_bus) { err = -ENOMEM; - goto unregister_notifier; + goto teardown; } dsa_slave_mii_bus_init(ds); err = mdiobus_register(ds->slave_mii_bus); if (err < 0) - goto unregister_notifier; + goto teardown; } ds->setup = true; return 0; +teardown: + if (ds->ops->teardown) + ds->ops->teardown(ds); unregister_notifier: dsa_switch_unregister_notifier(ds); unregister_devlink_ports: