diff options
author | Toshi Kani <toshi.kani@hpe.com> | 2016-02-20 23:32:24 +0100 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2016-02-24 02:17:20 +0100 |
commit | 93f834df9c2d4e362dfdc4b05daa0a4e18814836 (patch) | |
tree | 3f17712ac8c9e41baa072484c73032c2596ba228 /kernel/memremap.c | |
parent | nfit: update address range scrub commands to the acpi 6.1 format (diff) | |
download | linux-93f834df9c2d4e362dfdc4b05daa0a4e18814836.tar.xz linux-93f834df9c2d4e362dfdc4b05daa0a4e18814836.zip |
devm_memremap: Fix error value when memremap failed
devm_memremap() returns an ERR_PTR() value in case of error.
However, it returns NULL when memremap() failed. This causes
the caller, such as the pmem driver, to proceed and oops later.
Change devm_memremap() to return ERR_PTR(-ENXIO) when memremap()
failed.
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: <stable@vger.kernel.org>
Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'kernel/memremap.c')
-rw-r--r-- | kernel/memremap.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/memremap.c b/kernel/memremap.c index 2c468dea60bc..b04ea2f5fbfe 100644 --- a/kernel/memremap.c +++ b/kernel/memremap.c @@ -136,8 +136,10 @@ void *devm_memremap(struct device *dev, resource_size_t offset, if (addr) { *ptr = addr; devres_add(dev, ptr); - } else + } else { devres_free(ptr); + return ERR_PTR(-ENXIO); + } return addr; } |