All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] release /dev/nvmeX if nvme_probe failed
@ 2018-07-01 15:20 Weiping Zhang
  2018-07-01 15:20 ` [PATCH 1/2] nvme-pci: remove whitespace Weiping Zhang
  2018-07-01 15:20 ` [PATCH 2/2] nvme-pci: release nvme_ctrl if failed to alloc memory in nvme_probe Weiping Zhang
  0 siblings, 2 replies; 9+ messages in thread
From: Weiping Zhang @ 2018-07-01 15:20 UTC (permalink / raw)


First patch only remove whitespace, coding style fixup.
Second patch, remove nvme_ctrl device (/dev/nvmeX) if failed to alloc
memory for iod_mempool in nvme_probe.

Weiping Zhang (2):
  nvme-pci: remove whitespace
  nvme-pci: release nvme_ctrl if failed to alloc memory in nvme_probe

 drivers/nvme/host/pci.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

-- 
2.14.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] nvme-pci: remove whitespace
  2018-07-01 15:20 [PATCH 0/2] release /dev/nvmeX if nvme_probe failed Weiping Zhang
@ 2018-07-01 15:20 ` Weiping Zhang
  2018-07-02  9:49   ` Sagi Grimberg
                     ` (2 more replies)
  2018-07-01 15:20 ` [PATCH 2/2] nvme-pci: release nvme_ctrl if failed to alloc memory in nvme_probe Weiping Zhang
  1 sibling, 3 replies; 9+ messages in thread
From: Weiping Zhang @ 2018-07-01 15:20 UTC (permalink / raw)


Signed-off-by: Weiping Zhang <zhangweiping at didichuxing.com>
---
 drivers/nvme/host/pci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index ba943f211687..abf1885d6db6 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2585,13 +2585,13 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	return 0;
 
- release_pools:
+release_pools:
 	nvme_release_prp_pools(dev);
- unmap:
+unmap:
 	nvme_dev_unmap(dev);
- put_pci:
+put_pci:
 	put_device(dev->dev);
- free:
+free:
 	kfree(dev->queues);
 	kfree(dev);
 	return result;
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] nvme-pci: release nvme_ctrl if failed to alloc memory in nvme_probe
  2018-07-01 15:20 [PATCH 0/2] release /dev/nvmeX if nvme_probe failed Weiping Zhang
  2018-07-01 15:20 ` [PATCH 1/2] nvme-pci: remove whitespace Weiping Zhang
@ 2018-07-01 15:20 ` Weiping Zhang
  2018-07-02  9:53   ` Sagi Grimberg
  1 sibling, 1 reply; 9+ messages in thread
From: Weiping Zhang @ 2018-07-01 15:20 UTC (permalink / raw)


release nvme_ctrl if failed to alloc memory for iod_mempool, otherwise
/dev/nvmeX cann't be removed for this nvme controller, any ioctl to
this device doesn't work.

Signed-off-by: Weiping Zhang <zhangweiping at didichuxing.com>
---
 drivers/nvme/host/pci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index abf1885d6db6..d4f1f3b900e6 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2575,7 +2575,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 						GFP_KERNEL, node);
 	if (!dev->iod_mempool) {
 		result = -ENOMEM;
-		goto release_pools;
+		goto release_ctrl;
 	}
 
 	dev_info(dev->ctrl.device, "pci function %s\n", dev_name(&pdev->dev));
@@ -2585,6 +2585,9 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	return 0;
 
+release_ctrl:
+	nvme_uninit_ctrl(&dev->ctrl);
+	nvme_put_ctrl(&dev->ctrl);
 release_pools:
 	nvme_release_prp_pools(dev);
 unmap:
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 1/2] nvme-pci: remove whitespace
  2018-07-01 15:20 ` [PATCH 1/2] nvme-pci: remove whitespace Weiping Zhang
@ 2018-07-02  9:49   ` Sagi Grimberg
  2018-07-02 13:07   ` Christoph Hellwig
  2018-07-02 15:45   ` Keith Busch
  2 siblings, 0 replies; 9+ messages in thread
From: Sagi Grimberg @ 2018-07-02  9:49 UTC (permalink / raw)


Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/2] nvme-pci: release nvme_ctrl if failed to alloc memory in nvme_probe
  2018-07-01 15:20 ` [PATCH 2/2] nvme-pci: release nvme_ctrl if failed to alloc memory in nvme_probe Weiping Zhang
@ 2018-07-02  9:53   ` Sagi Grimberg
  2018-07-02 16:13     ` Weiping Zhang
  0 siblings, 1 reply; 9+ messages in thread
From: Sagi Grimberg @ 2018-07-02  9:53 UTC (permalink / raw)



> +release_ctrl:
> +	nvme_uninit_ctrl(&dev->ctrl);
> +	nvme_put_ctrl(&dev->ctrl);

Hmm, put_ctrl would trigger nvme_pci_free_ctrl which will
do some of what you fallthru down here, won't that cause
double free/put?

>   release_pools:
>   	nvme_release_prp_pools(dev);
>   unmap:
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] nvme-pci: remove whitespace
  2018-07-01 15:20 ` [PATCH 1/2] nvme-pci: remove whitespace Weiping Zhang
  2018-07-02  9:49   ` Sagi Grimberg
@ 2018-07-02 13:07   ` Christoph Hellwig
  2018-07-02 15:45   ` Keith Busch
  2 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2018-07-02 13:07 UTC (permalink / raw)


Please, no whitespace cleanups before critical patches.

Also both styles in this case are acceptable in the kernel.  I
personally prefer to not have space, but we really shouldn't spuriously
change it.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] nvme-pci: remove whitespace
  2018-07-01 15:20 ` [PATCH 1/2] nvme-pci: remove whitespace Weiping Zhang
  2018-07-02  9:49   ` Sagi Grimberg
  2018-07-02 13:07   ` Christoph Hellwig
@ 2018-07-02 15:45   ` Keith Busch
  2018-07-02 16:10     ` Weiping Zhang
  2 siblings, 1 reply; 9+ messages in thread
From: Keith Busch @ 2018-07-02 15:45 UTC (permalink / raw)


These style changes aren't the sort of cleanups we need. For one, there's
nothing wrong with how it already exists, and it has been this particular
style since the driver's inclusion; there are lots of other places in
the driver using this pattern. More importantly, it creates inconvenient
stable porting issues for developers doing real work in these areas.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] nvme-pci: remove whitespace
  2018-07-02 15:45   ` Keith Busch
@ 2018-07-02 16:10     ` Weiping Zhang
  0 siblings, 0 replies; 9+ messages in thread
From: Weiping Zhang @ 2018-07-02 16:10 UTC (permalink / raw)


Keith Busch <keith.busch at linux.intel.com> ?2018?7?2??? ??11:46???
>
> These style changes aren't the sort of cleanups we need. For one, there's
> nothing wrong with how it already exists, and it has been this particular
> style since the driver's inclusion; there are lots of other places in
> the driver using this pattern. More importantly, it creates inconvenient
> stable porting issues for developers doing real work in these areas.
>
OK, I drop this one
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/2] nvme-pci: release nvme_ctrl if failed to alloc memory in nvme_probe
  2018-07-02  9:53   ` Sagi Grimberg
@ 2018-07-02 16:13     ` Weiping Zhang
  0 siblings, 0 replies; 9+ messages in thread
From: Weiping Zhang @ 2018-07-02 16:13 UTC (permalink / raw)


Sagi Grimberg <sagi at grimberg.me> ?2018?7?2??? ??5:54???
>
>
> > +release_ctrl:
> > +     nvme_uninit_ctrl(&dev->ctrl);
> > +     nvme_put_ctrl(&dev->ctrl);
>
> Hmm, put_ctrl would trigger nvme_pci_free_ctrl which will
> do some of what you fallthru down here, won't that cause
> double free/put?
>
You are right, I plan to move all this cleanup to nvme_pci_ctrl_free,
If failed before call nvme_init_ctrl, do cleanup by these goto.
if failed after call nvme_init_ctrl, direct use nvme_put_ctrl to release
all these resource.

I'll send V2.
> >   release_pools:
> >       nvme_release_prp_pools(dev);
> >   unmap:
> >
>
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-07-02 16:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-01 15:20 [PATCH 0/2] release /dev/nvmeX if nvme_probe failed Weiping Zhang
2018-07-01 15:20 ` [PATCH 1/2] nvme-pci: remove whitespace Weiping Zhang
2018-07-02  9:49   ` Sagi Grimberg
2018-07-02 13:07   ` Christoph Hellwig
2018-07-02 15:45   ` Keith Busch
2018-07-02 16:10     ` Weiping Zhang
2018-07-01 15:20 ` [PATCH 2/2] nvme-pci: release nvme_ctrl if failed to alloc memory in nvme_probe Weiping Zhang
2018-07-02  9:53   ` Sagi Grimberg
2018-07-02 16:13     ` Weiping Zhang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.