From patchwork Sat Dec 2 19:26:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10088985 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E702260380 for ; Sat, 2 Dec 2017 19:27:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D827B2934A for ; Sat, 2 Dec 2017 19:27:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC2952935B; Sat, 2 Dec 2017 19:27:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 662C62934A for ; Sat, 2 Dec 2017 19:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=uyJHCT8VDdImoROzX4eP7RB5RoFQc50ATub9LDTzBIY=; b=EtsG9+7iOzl6fRZUCaIcPISqI5 5CA0zwwQVQZusRvcIr+mv/Rsh8zTd0VKL26i8HOXmXxW/+7Ldc0IXd0lQWegZdl3zQiS31JLgIarV UNpauXVFooKQYuqZMHYF8BYPqPwHM7bj1F2QNsPtN06m7qrEtbk/QBfZkr3izat0IFm0d9jP0CZSC tuWQ6V/kyt+jnmanf1WNqh0yy0cWaknRiLGA1dKZ0zLiCUnxM7OC1N1ZlAfHQCokvm6bH5YlnZJ4M L1+xyotnFdRip4lcDzPg9J6RdcVQNXgEPjw5u32d/DZW+msWVqW9H1VQ4j6zIv+LmoQwIfKyNnUn8 Ja2U8tjA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eLDRT-0000Rd-FM; Sat, 02 Dec 2017 19:27:15 +0000 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eLDRD-0008S7-0C for linux-arm-kernel@lists.infradead.org; Sat, 02 Dec 2017 19:27:00 +0000 Received: by mail-pl0-x243.google.com with SMTP id s10so8131277plj.5 for ; Sat, 02 Dec 2017 11:26:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=c5yPUC96jn/8H+4UY4VH7zzqjk2anlVoo6BwYSe2BmA=; b=prRzuaaqDg1KEL/m8QxOyySSjSPtGnd2GBSB9lPc8CRf2nkvFRz0UsD08ItH+/o999 sr6jukDogjRWkyzHVn3jjattF1+itAyiQbRc4XzKkPOISpzk6BOCHetLfyZCfz2LO7St CzXQ5RXicYDKRufzNBPX90f4B4yhFEa2MnbFa9x/2e8LWkgQK4E/IiMi1lDgRKkll7nR bVgqbmsxwTZpNBamaXn7OVEN2elNykZnxGNYKNCagbG+3U0+41I8GXNFTDeZKk2CZivy 5BZMHwj9N2dQ4W4wRejxmtxJBC9G0OibS+CwR8Q0gSAFzqq+2Wxzvkic9z5NHb9lwu0G psXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=c5yPUC96jn/8H+4UY4VH7zzqjk2anlVoo6BwYSe2BmA=; b=mxCBbRIoqBVM13+Tah45Isp6OudroHjUdokpI4PfucELB846vUtupvt3ueh9Nbn8bD xOlEBQEUV3koAZD3kCXza/x9lELRUILCC+HVsACVe5IPIOFO7KuRI7t/KPI/IzsrqNBx YCfLanGnSvh0dyA39o3IREg/uhnhjxjHE1oQMDIp41R4AT0Ey0GJz0kAh5oWbQGcNbY+ SDyyM1uX/83J44YK2eubsVjNpFG8xGXGobD5+doecmMDQy/W8BSn7QxW+3NNzCIbGTSk gJn/kfUJWKaWMY6kB5f2oFYW2olBe11iwe1Ae/nbeyq4TkeBADGHYwEDwyC4A7OyKVfq WfuA== X-Gm-Message-State: AJaThX7qF+DicaJPrx18bCM1hK1TTEc01IQ1Okzz/RuYOi4r8HmvzwsO Tw3pYP8OApWADsxtDW7y4mQ= X-Google-Smtp-Source: AGs4zMafBK0ePykW1chjRvGEJtdsZwWgrthlLBy+O5+HlZobOxoMXw5Sjeutyv1uBKMzh1K5v9nRNg== X-Received: by 10.84.168.193 with SMTP id f59mr9832432plb.22.1512242799975; Sat, 02 Dec 2017 11:26:39 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id 140sm15167899pgd.85.2017.12.02.11.26.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 02 Dec 2017 11:26:39 -0800 (PST) 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171202_112659_098254_708BE016 X-CRM114-Status: GOOD ( 10.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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);