Thread (25 messages) 25 messages, 3 authors, 2018-09-25

Re: [PATCH v7 02/13] PCI/P2PDMA: Add sysfs group to display p2pmem stats

From: Logan Gunthorpe <logang@deltatee.com>
Date: 2018-09-25 18:15:36
Also in: linux-nvme, linux-pci, linux-rdma, lkml, nvdimm


On 2018-09-25 11:29 a.m., Bart Van Assche wrote:
On Tue, 2018-09-25 at 10:22 -0600, Logan Gunthorpe wrote:
quoted
@@ -83,9 +132,14 @@ static int pci_p2pdma_setup(struct pci_dev *pdev)
 
 	pdev->p2pdma = p2p;
 
+	error = sysfs_create_group(&pdev->dev.kobj, &p2pmem_group);
+	if (error)
+		goto out_pool_destroy;
+
 	return 0;
 
 out_pool_destroy:
+	pdev->p2pdma = NULL;
 	gen_pool_destroy(p2p->pool);
 out:
 	devm_kfree(&pdev->dev, p2p);
This doesn't look right to me. Shouldn't devm_remove_action() be called instead
of devm_kfree() if sysfs_create_group() fails?
That makes no sense to me. We are reversing a devm_kzalloc() not a
custom action....

One could argue we should _also_ remove the pci_p2pdma_release() action,
but seeing it has a NULL check on pdev->p2pdma it's pretty harmless to
leave in.

Logan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help