From patchwork Tue Aug 8 11:37:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pan Bian X-Patchwork-Id: 9887623 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 6E736601EB for ; Tue, 8 Aug 2017 11:38:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61DCC287D5 for ; Tue, 8 Aug 2017 11:38:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56CD7287DA; Tue, 8 Aug 2017 11:38:38 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=unavailable 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 14062287D7 for ; Tue, 8 Aug 2017 11:38:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752283AbdHHLiL (ORCPT ); Tue, 8 Aug 2017 07:38:11 -0400 Received: from m12-17.163.com ([220.181.12.17]:42959 "EHLO m12-17.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752267AbdHHLiJ (ORCPT ); Tue, 8 Aug 2017 07:38:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=IPp3+wGPLmm4E37694 XZ37oEcQWdU8bQMm39bzPur50=; b=lLEUKcncuA676JxuUPDjToJcWaT8OMzn/7 3Ff2ve0Km+/VkRWGndTqV8FZdQiys0t45SmwGaUXLUdSjiLjdiYQhG4oxaihu2/2 nMPw+IowCghIQtLCrwQLJCN9FIQMtQVhraYuZ9tPbNH/X7CYtQpWol+USz3xb0wO IDNgahpH4= Received: from localhost.localdomain (unknown [106.120.213.62]) by smtp13 (Coremail) with SMTP id EcCowACn1dqToolZKHFuDQ--.13720S3; Tue, 08 Aug 2017 19:37:59 +0800 (CST) From: Pan Bian To: John Garry , "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Pan Bian Subject: scsi: hisi_sas: replace kfree with scsi_host_put Date: Tue, 8 Aug 2017 19:37:43 +0800 Message-Id: <1502192263-12332-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: EcCowACn1dqToolZKHFuDQ--.13720S3 X-Coremail-Antispam: 1Uf129KBjvJXoWruFWUZw1UAFykAw1rWr15Arb_yoW8Jr45pF WUJrW29r48Gr42gwnruF43Xr1Fga10q3Z0g3ya934kZFn8Jw1kJr1DCayIqFW5JFWUWan8 JFsFqFyrC3W8JFDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j-PEfUUUUU= X-Originating-IP: [106.120.213.62] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/xtbBZBYuclQG9fPCHwAAsn 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 Return value of scsi_host_alloc() should be released with scsi_host_put() rather than kfree(). Signed-off-by: Pan Bian --- drivers/scsi/hisi_sas/hisi_sas_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 4022c3f..22d8922 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1825,7 +1825,7 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev, return shost; err_out: - kfree(shost); + scsi_host_put(shost); dev_err(dev, "shost alloc failed\n"); return NULL; } @@ -1916,7 +1916,7 @@ int hisi_sas_probe(struct platform_device *pdev, scsi_remove_host(shost); err_out_ha: hisi_sas_free(hisi_hba); - kfree(shost); + scsi_host_put(shost); return rc; } EXPORT_SYMBOL_GPL(hisi_sas_probe); @@ -1931,7 +1931,7 @@ int hisi_sas_remove(struct platform_device *pdev) sas_remove_host(sha->core.shost); hisi_sas_free(hisi_hba); - kfree(shost); + scsi_host_put(shost); return 0; } EXPORT_SYMBOL_GPL(hisi_sas_remove);