From patchwork Sat Nov 19 17:42:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Lambert X-Patchwork-Id: 9438301 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 E9C0460469 for ; Sat, 19 Nov 2016 17:46:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCF1F28D9B for ; Sat, 19 Nov 2016 17:46:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CFFD628EC1; Sat, 19 Nov 2016 17:46:26 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A3BA28D9B for ; Sat, 19 Nov 2016 17:46:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752932AbcKSRqZ (ORCPT ); Sat, 19 Nov 2016 12:46:25 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33788 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752441AbcKSRqX (ORCPT ); Sat, 19 Nov 2016 12:46:23 -0500 Received: by mail-wm0-f66.google.com with SMTP id u144so14696948wmu.0; Sat, 19 Nov 2016 09:46:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=eAQzSycO261MDinrMq0Dw4qNC59CPSd5HmZhqqVHU4M=; b=KjGDUb4ZGlxMdxMXMtWz40EMmBYbq3ayqgmDgTJZgqLDEEyKd0HgcrBIUpykBQ5co5 5+aHG4VUPbuxrcP8Yrw69e2q+ZNBkoGWgnXST+ZnZk5wJdMhbIzrzqOZELesM2sg+lKl H8W7WhTetG+0cAzeivljAdbhAW6JyELXvrXQxbxyhpf9rntyBvwDIYCNqbwx99jOPNPc +XoXuA3hOJKBevbIMZyz2gjkWKvn8HKIG0I/+t6U6kUksi6gKEkug22jF5PCsub9zpdo di+NUZ2/nWj1D1+/qN4hMrOT+ZToFsb3oDGtQaJQV1rfr+fFZNi2ECk6SRbkEUr+VR2o 9vrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=eAQzSycO261MDinrMq0Dw4qNC59CPSd5HmZhqqVHU4M=; b=EX+PMW1oKO8Df4a1QLfKNIa7+WcXqUMXDmlhf7V16mEtmqBVrydnEpNY6y99PQ906C oxzz8t7kbCKTeRQ4eR5iT/DV7M2ILZPOeRvg8HMfoKMJh0XD1NxUL80U4tTqgyEB1Q/U FBsq8FyfslUXMtfkQLgH76acgTXyCu6hWHnjONJtAiJDVisvsCtldXNE8X/NOHB0e4aq JcprVZ4PIX5vnjeaiQ0ipz8Vw5Hza5QZkL0t9wd73FFBmsgo7QwQb2tYGSQNVcQPPZW2 Sv03wJahHd9XvcvRTVWGPdYZJXEf0gXs5pECs+O/k4wL0y+dqAMMv8kDD0s0H9gMgeqm OICw== X-Gm-Message-State: AKaTC022YHcLKtvvzqt8t2jrTyN18KfkncGjBcEtmolDW9csaRrN2Zm3ZXRq1Xw51uHFyw== X-Received: by 10.28.0.210 with SMTP id 201mr4232035wma.49.1479577582113; Sat, 19 Nov 2016 09:46:22 -0800 (PST) Received: from localhost.localdomain ([2a01:e35:8a86:9030:c685:8ff:fe2a:cb32]) by smtp.gmail.com with ESMTPSA id f126sm9778636wme.22.2016.11.19.09.46.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Nov 2016 09:46:21 -0800 (PST) From: Quentin Lambert To: John Garry , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Cc: Quentin Lambert Subject: [PATCH] scsi: hisi_sas: Add a missing call to kfree Date: Sat, 19 Nov 2016 18:42:59 +0100 Message-Id: <20161119174259.20344-1-lambert.quentin@gmail.com> X-Mailer: git-send-email 2.10.2 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Most error branches following the call to hisi_sas_shost_alloc contain a call to kfree. This patch add these calls where they are missing. This issue was found with Hector. Signed-off-by: Quentin Lambert --- drivers/scsi/hisi_sas/hisi_sas_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1503,8 +1503,10 @@ int hisi_sas_probe(struct platform_devic arr_phy = devm_kcalloc(dev, phy_nr, sizeof(void *), GFP_KERNEL); arr_port = devm_kcalloc(dev, port_nr, sizeof(void *), GFP_KERNEL); - if (!arr_phy || !arr_port) - return -ENOMEM; + if (!arr_phy || !arr_port) { + rc = -ENOMEM; + goto err_out_ha; + } sha->sas_phy = arr_phy; sha->sas_port = arr_port;