From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90998C38A2A for ; Fri, 8 May 2020 13:04:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 725C820870 for ; Fri, 8 May 2020 13:04:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588943061; bh=1QYDlRPcvqbyXMsB9wotdQhXZF3aw5xyGZAehkYXLsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=PXUShUIsntBsFsQyG1qn2HZcDd0hNF0aX5xum4PXdvnGUwDFP6xeQ5mAcET8wKDRG Rgp1/2+ugFZzw7KzbXdxMoCJSGUJIxukbL9cwjuedoByV3FsM03gOVzdqE5fX5Rsxs Mey/IkKbCyhQT2Av8L6BE0QtBlv9HjruZqNgGu5A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728037AbgEHNEQ (ORCPT ); Fri, 8 May 2020 09:04:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:54560 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729342AbgEHMtN (ORCPT ); Fri, 8 May 2020 08:49:13 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 13C92218AC; Fri, 8 May 2020 12:49:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588942153; bh=1QYDlRPcvqbyXMsB9wotdQhXZF3aw5xyGZAehkYXLsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d9njWvpE6h7DRDmIaavMPDWZt2vxCsHxvK28ly8lDoXoBFeRWQkcukrE/cNdr6PQ+ YT2jigdG3xOFP5nlUrWSkXXD805TFMkY1bY4jy6xHtygR/5f/Zv9azKLwFTCD9YAoC C6bSBoJ3l5xOzqzs4lPBHRMnhLK7h/7baB5mHAm0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , "David S. Miller" Subject: [PATCH 4.4 279/312] net: ethernet: ti: cpsw: fix secondary-emac probe error path Date: Fri, 8 May 2020 14:34:30 +0200 Message-Id: <20200508123144.041298536@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200508123124.574959822@linuxfoundation.org> References: <20200508123124.574959822@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Johan Hovold commit a7fe9d466f6a33558a38c7ca9d58bcc83512d577 upstream. Make sure to deregister the primary device in case the secondary emac fails to probe. kernel BUG at /home/johan/work/omicron/src/linux/net/core/dev.c:7743! ... [] (free_netdev) from [] (cpsw_probe+0x9cc/0xe50) [] (cpsw_probe) from [] (platform_drv_probe+0x5c/0xc0) Fixes: d9ba8f9e6298 ("driver: net: ethernet: cpsw: dual emac interface implementation") Signed-off-by: Johan Hovold Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/ti/cpsw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -2532,12 +2532,14 @@ static int cpsw_probe(struct platform_de ret = cpsw_probe_dual_emac(pdev, priv); if (ret) { cpsw_err(priv, probe, "error probe slave 2 emac interface\n"); - goto clean_ale_ret; + goto clean_unregister_netdev_ret; } } return 0; +clean_unregister_netdev_ret: + unregister_netdev(ndev); clean_ale_ret: cpsw_ale_destroy(priv->ale); clean_dma_ret: