From: John Garry <john.garry@huawei.com>
To: Pan Bian <bianpan2016@163.com>,
"James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: <linux-scsi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Linuxarm <linuxarm@huawei.com>
Subject: Re: scsi: hisi_sas: replace kfree with scsi_host_put
Date: Tue, 8 Aug 2017 15:56:22 +0100 [thread overview]
Message-ID: <c39e1cef-5356-01b7-5316-10ba45f0bba8@huawei.com> (raw)
In-Reply-To: <1502192263-12332-1-git-send-email-bianpan2016@163.com>
On 08/08/2017 12:37, Pan Bian wrote:
> Return value of scsi_host_alloc() should be released with
> scsi_host_put() rather than kfree().
>
> Signed-off-by: Pan Bian <bianpan2016@163.com>
We also have a kfree(shost) in newly added pci-based v3 driver which
would need replacing for consistency.
But, apart from that, we seem to have a pre-existing issue in
hisi_sas_shost_alloc_pci(), which is missing the shost clean-up for
error path.
Let me know if you want me to take over this patch and fix up the other
places.
John
> ---
> 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);
>
next prev parent reply other threads:[~2017-08-08 14:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-08 11:37 Pan Bian
2017-08-08 14:56 ` John Garry [this message]
2017-08-08 15:12 ` PanBian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c39e1cef-5356-01b7-5316-10ba45f0bba8@huawei.com \
--to=john.garry@huawei.com \
--cc=bianpan2016@163.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®