* [PATCH] PCI/P2PDMA: Fix NULL check in pci_p2pmem_publish()
@ 2018-10-17 16:05 Logan Gunthorpe
2018-10-17 17:19 ` Bjorn Helgaas
0 siblings, 1 reply; 2+ messages in thread
From: Logan Gunthorpe @ 2018-10-17 16:05 UTC (permalink / raw)
To: linux-kernel, linux-pci
Cc: Dan Carpenter, Logan Gunthorpe, Bjorn Helgaas, Christoph Hellwig
We should only assign 'p2pmem_published' if 'pdev->p2pdma' is not NULL.
The extra check on 'publish' makes no sense.
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Christoph Hellwig <hch@infradead.org>
---
drivers/pci/p2pdma.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
index da66c7e31730..d710b5ef65a1 100644
--- a/drivers/pci/p2pdma.c
+++ b/drivers/pci/p2pdma.c
@@ -678,10 +678,8 @@ EXPORT_SYMBOL_GPL(pci_p2pmem_free_sgl);
*/
void pci_p2pmem_publish(struct pci_dev *pdev, bool publish)
{
- if (publish && !pdev->p2pdma)
- return;
-
- pdev->p2pdma->p2pmem_published = publish;
+ if (pdev->p2pdma)
+ pdev->p2pdma->p2pmem_published = publish;
}
EXPORT_SYMBOL_GPL(pci_p2pmem_publish);
--
2.19.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] PCI/P2PDMA: Fix NULL check in pci_p2pmem_publish()
2018-10-17 16:05 [PATCH] PCI/P2PDMA: Fix NULL check in pci_p2pmem_publish() Logan Gunthorpe
@ 2018-10-17 17:19 ` Bjorn Helgaas
0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2018-10-17 17:19 UTC (permalink / raw)
To: Logan Gunthorpe
Cc: linux-kernel, linux-pci, Dan Carpenter, Bjorn Helgaas, Christoph Hellwig
On Wed, Oct 17, 2018 at 10:05:10AM -0600, Logan Gunthorpe wrote:
> We should only assign 'p2pmem_published' if 'pdev->p2pdma' is not NULL.
> The extra check on 'publish' makes no sense.
>
> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Christoph Hellwig <hch@infradead.org>
I folded this into the original commit on pci/peer-to-peer, thanks!
> ---
> drivers/pci/p2pdma.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
> index da66c7e31730..d710b5ef65a1 100644
> --- a/drivers/pci/p2pdma.c
> +++ b/drivers/pci/p2pdma.c
> @@ -678,10 +678,8 @@ EXPORT_SYMBOL_GPL(pci_p2pmem_free_sgl);
> */
> void pci_p2pmem_publish(struct pci_dev *pdev, bool publish)
> {
> - if (publish && !pdev->p2pdma)
> - return;
> -
> - pdev->p2pdma->p2pmem_published = publish;
> + if (pdev->p2pdma)
> + pdev->p2pdma->p2pmem_published = publish;
> }
> EXPORT_SYMBOL_GPL(pci_p2pmem_publish);
>
> --
> 2.19.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-17 17:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-17 16:05 [PATCH] PCI/P2PDMA: Fix NULL check in pci_p2pmem_publish() Logan Gunthorpe
2018-10-17 17:19 ` Bjorn Helgaas
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.