Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753252AbcKSRq0 (ORCPT ); Sat, 19 Nov 2016 12:46:26 -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 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 808 Lines: 27 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(-) --- 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;