Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp390483ybl; Tue, 20 Aug 2019 22:28:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqxeKRwdy10clcXQ9ZjNXLQcuD+JAeLbmm7KH3mA+uUdGaNE3j4EERnuMaRuA7fAJ2I7Bfyk X-Received: by 2002:a63:5b23:: with SMTP id p35mr27095709pgb.366.1566365313208; Tue, 20 Aug 2019 22:28:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566365313; cv=none; d=google.com; s=arc-20160816; b=Kx5ezrRklceILh+dGrU4TO2EFtH2AL274lIo6UXK7x+VBecD6Htsz+nX3avD6Cy/hg l/kABJlhmOFskUW2S+EkTXUAKV62CPEshhCFi46CAr1DWhomNvucqy1ALB82k8jritVf cTARhvnYzOid0jD4sJVjI+1OkE6riQhNuT74rDg8pmeKghzAE+JD/khYizA1XQ1FxD45 6H+lppYNKSniprPqA5swxRWUdU7yaDW1vhjmt1Tnm/WwMQ+5rfcNn1z2CD/diA4Hnclj dB/TlbPRxONwruhEjDd1YKcWlksVUw2I5jLOiOzYigjTTv0v2jIHVwcvLzpVZCrh6zFS xwrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=kxL2K/UgIPrq03eGU3MZLRfsEiG5CCTnJCgH/oJDhFQ=; b=erD5Pcdc4cz9OUHlzAOxuaavcanTX4me8skBR+ZbU4na0N0lRx7PO2ObfQlvRiE7xG jXc4qTOwek11YJuORO7/DdbE2G73fZT3mQWGswVZwe66Nz6Et2CMKJf39XVg4+l96GMO m0Y0O7SsUVLwxP6vRZTfVSJ/WX/lkNOriYvh3VVnDwoOTnp0CUA8XBodxoLvP8vMLHYP QW6R3VRuE+U0S1lLFwAORhGmnLn7DEYuKtjP+DqlckVhcPRBsf3iH6dtPdZYr5PkPJsQ A1k9N4rzVazR7dI6GWb5z6UaeyOOLn94YVVqB3+pgBDIAj9pWhcN4K53Y2ruNEKKrNgP mPRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i10si14497180pfd.226.2019.08.20.22.28.18; Tue, 20 Aug 2019 22:28:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727484AbfHUErR (ORCPT + 99 others); Wed, 21 Aug 2019 00:47:17 -0400 Received: from mail-yw1-f67.google.com ([209.85.161.67]:34961 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727322AbfHUErR (ORCPT ); Wed, 21 Aug 2019 00:47:17 -0400 Received: by mail-yw1-f67.google.com with SMTP id g19so435565ywe.2; Tue, 20 Aug 2019 21:47:16 -0700 (PDT) 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; bh=kxL2K/UgIPrq03eGU3MZLRfsEiG5CCTnJCgH/oJDhFQ=; b=hhSGYpEJi+fiIGwrIaKkNzWWSizjKMr2UeKUOcLutfM75oV6pwzT4eDTtvPho4lzmZ +UeK/UldFAYQyJtzyK/RtffGUtaKn9nOT51ZSOcl2Co7UH5p2ILMg0xVZAzB4is+g+Gk ckfqYr0BvXGYh5rW7aVL14ePfxj+jvL2PGgllbBEtfS0+AFvhyyIL97YQo/LT2jqEymK 7CzinFv5R0ISb3YJI1WTxfINq2xSDUGoL07lN9KlZlzzR5kdqwDJ/d2/AXj180mcBXDm czCSMdTirCNE5TY9keTcO72qDRa3+qICY2ijAPpK+c95bIAd7/aOOpnO2lJx0Zb29zWC 81bA== X-Gm-Message-State: APjAAAVXko7GeOT0Hcmoxtfn+gcRe725sDESX6qjkISgEAJO1vtkciqy SYcVtNwYdreCsM+7Q4howU0= X-Received: by 2002:a0d:dd51:: with SMTP id g78mr21950930ywe.102.1566362835944; Tue, 20 Aug 2019 21:47:15 -0700 (PDT) Received: from localhost.localdomain (24-158-240-219.dhcp.smyr.ga.charter.com. [24.158.240.219]) by smtp.gmail.com with ESMTPSA id r193sm2670175ywe.8.2019.08.20.21.47.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Aug 2019 21:47:14 -0700 (PDT) From: Wenwen Wang To: Wenwen Wang Cc: Sudarsana Reddy Kalluru , Ariel Elior , GR-everest-linux-l2@marvell.com (supporter:QLOGIC QL4xxx ETHERNET DRIVER), "David S. Miller" , netdev@vger.kernel.org (open list:QLOGIC QL4xxx ETHERNET DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2] qed: Add cleanup in qed_slowpath_start() Date: Tue, 20 Aug 2019 23:46:36 -0500 Message-Id: <1566362796-5399-1-git-send-email-wenwen@cs.uga.edu> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If qed_mcp_send_drv_version() fails, no cleanup is executed, leading to memory leaks. To fix this issue, introduce the label 'err4' to perform the cleanup work before returning the error. Signed-off-by: Wenwen Wang --- drivers/net/ethernet/qlogic/qed/qed_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c index 829dd60..1efff7f 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_main.c +++ b/drivers/net/ethernet/qlogic/qed/qed_main.c @@ -1325,7 +1325,7 @@ static int qed_slowpath_start(struct qed_dev *cdev, &drv_version); if (rc) { DP_NOTICE(cdev, "Failed sending drv version command\n"); - return rc; + goto err4; } } @@ -1333,6 +1333,8 @@ static int qed_slowpath_start(struct qed_dev *cdev, return 0; +err4: + qed_ll2_dealloc_if(cdev); err3: qed_hw_stop(cdev); err2: -- 2.7.4