Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1706400 > unrolled thread
| Started by | Pan Bian <bianpan2016@163.com> |
|---|---|
| First post | 2017-08-08 13:40 +0200 |
| Last post | 2017-08-08 17:20 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
scsi: hisi_sas: replace kfree with scsi_host_put Pan Bian <bianpan2016@163.com> - 2017-08-08 13:40 +0200
Re: scsi: hisi_sas: replace kfree with scsi_host_put John Garry <john.garry@huawei.com> - 2017-08-08 17:00 +0200
Re: scsi: hisi_sas: replace kfree with scsi_host_put PanBian <bianpan2016@163.com> - 2017-08-08 17:20 +0200
| From | Pan Bian <bianpan2016@163.com> |
|---|---|
| Date | 2017-08-08 13:40 +0200 |
| Subject | scsi: hisi_sas: replace kfree with scsi_host_put |
| Message-ID | <ucb1E-7Kd-21@gated-at.bofh.it> |
Return value of scsi_host_alloc() should be released with scsi_host_put() rather than kfree(). Signed-off-by: Pan Bian <bianpan2016@163.com> --- 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); -- 1.9.1
[toc] | [next] | [standalone]
| From | John Garry <john.garry@huawei.com> |
|---|---|
| Date | 2017-08-08 17:00 +0200 |
| Message-ID | <uce9c-1st-31@gated-at.bofh.it> |
| In reply to | #1706400 |
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); >
[toc] | [prev] | [next] | [standalone]
| From | PanBian <bianpan2016@163.com> |
|---|---|
| Date | 2017-08-08 17:20 +0200 |
| Message-ID | <ucesx-1PL-7@gated-at.bofh.it> |
| In reply to | #1706635 |
On Tue, Aug 08, 2017 at 03:56:22PM +0100, John Garry wrote: > 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. Yes, of course. > > John > Thank you, 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); > > > >
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web