Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752390AbdLBT0o (ORCPT ); Sat, 2 Dec 2017 14:26:44 -0500 Received: from mail-pl0-f67.google.com ([209.85.160.67]:34325 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752302AbdLBT0k (ORCPT ); Sat, 2 Dec 2017 14:26:40 -0500 X-Google-Smtp-Source: AGs4zMafBK0ePykW1chjRvGEJtdsZwWgrthlLBy+O5+HlZobOxoMXw5Sjeutyv1uBKMzh1K5v9nRNg== From: Arvind Yadav To: wg@grandegger.com, mkl@pengutronix.de, michal.simek@xilinx.com, opendmb@gmail.com, f.fainelli@gmail.com, davem@davemloft.net, Vladislav.Zakharov@synopsys.com Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org Subject: [PATCH 02/10] net: bcmgenet: free netdev on of_match_node() error Date: Sun, 3 Dec 2017 00:56:14 +0530 Message-Id: <1512242782-7134-3-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512242782-7134-1-git-send-email-arvind.yadav.cs@gmail.com> References: <1512242782-7134-1-git-send-email-arvind.yadav.cs@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 754 Lines: 26 The change is to call free_netdev(), If of_match_node() will fail. Signed-off-by: Arvind Yadav --- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index e2f1268..e0a8f79 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -3363,8 +3363,10 @@ static int bcmgenet_probe(struct platform_device *pdev) if (dn) { of_id = of_match_node(bcmgenet_match, dn); - if (!of_id) - return -EINVAL; + if (!of_id) { + err = -EINVAL; + goto err; + } } priv = netdev_priv(dev); -- 2.7.4