mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-06 05:02:31 +00:00
devm_memremap: convert to return ERR_PTR
Make devm_memremap consistent with the error return scheme of devm_memremap_pages to remove special casing in the pmem driver. Cc: Christoph Hellwig <hch@lst.de> Cc: Ross Zwisler <ross.zwisler@linux.intel.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
d741314fe8
commit
b36f47617f
@ -150,19 +150,15 @@ static struct pmem_device *pmem_alloc(struct device *dev,
|
||||
return ERR_PTR(-EBUSY);
|
||||
}
|
||||
|
||||
if (pmem_should_map_pages(dev)) {
|
||||
void *addr = devm_memremap_pages(dev, res);
|
||||
|
||||
if (IS_ERR(addr))
|
||||
return addr;
|
||||
pmem->virt_addr = (void __pmem *) addr;
|
||||
} else {
|
||||
if (pmem_should_map_pages(dev))
|
||||
pmem->virt_addr = (void __pmem *) devm_memremap_pages(dev, res);
|
||||
else
|
||||
pmem->virt_addr = (void __pmem *) devm_memremap(dev,
|
||||
pmem->phys_addr, pmem->size,
|
||||
ARCH_MEMREMAP_PMEM);
|
||||
if (!pmem->virt_addr)
|
||||
return ERR_PTR(-ENXIO);
|
||||
}
|
||||
|
||||
if (IS_ERR(pmem->virt_addr))
|
||||
return (void __force *) pmem->virt_addr;
|
||||
|
||||
return pmem;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ void *devm_memremap(struct device *dev, resource_size_t offset,
|
||||
|
||||
ptr = devres_alloc(devm_memremap_release, sizeof(*ptr), GFP_KERNEL);
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
addr = memremap(offset, size, flags);
|
||||
if (addr) {
|
||||
|
Loading…
Reference in New Issue
Block a user