Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754482AbcKUM5T (ORCPT ); Mon, 21 Nov 2016 07:57:19 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:62660 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753966AbcKUM5R (ORCPT ); Mon, 21 Nov 2016 07:57:17 -0500 Subject: Re: [PATCH] scsi: hisi_sas: Add a missing call to kfree To: Quentin Lambert , "James E.J. Bottomley" , "Martin K. Petersen" , , , References: <20161119174259.20344-1-lambert.quentin@gmail.com> From: John Garry Message-ID: Date: Mon, 21 Nov 2016 12:53:43 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20161119174259.20344-1-lambert.quentin@gmail.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.203.181.152] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1110 Lines: 42 On 19/11/2016 17:42, Quentin Lambert wrote: > 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. I think that this patch is fine. However I have noticed that we should do a call to hisi_sas_free() for this failure, and later failures in the probe. I can generate a patch for this. Cheers, John > > 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; > > . >