Skip to content
Commit bfac8e9f authored by Alan Mikhak's avatar Alan Mikhak Committed by Christoph Hellwig
Browse files

nvme-pci: check for NULL return from pci_alloc_p2pmem()



Modify nvme_alloc_sq_cmds() to call pci_free_p2pmem() to free the memory
it allocated using pci_alloc_p2pmem() in case pci_p2pmem_virt_to_bus()
returns null.

Makes sure not to call pci_free_p2pmem() if pci_alloc_p2pmem() returned
NULL, which can happen if CONFIG_PCI_P2PDMA is not configured.

The current implementation is not expected to leak since
pci_p2pmem_virt_to_bus() is expected to fail only if pci_alloc_p2pmem()
returns null. However, checking the return value of pci_alloc_p2pmem()
is more explicit.

Signed-off-by: default avatarAlan Mikhak <alan.mikhak@sifive.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 0298d543
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment