From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Toshi Kani <toshi.kani@hpe.com>
Cc: akpm@linux-foundation.org, dan.j.williams@intel.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-nvdimm@lists.01.org
Subject: Re: [PATCH] devm_memremap: Fix error value when memremap failed
Date: Fri, 5 Feb 2016 18:24:26 -0700 [thread overview]
Message-ID: <20160206012426.GA12447@linux.intel.com> (raw)
In-Reply-To: <1454722827-15744-1-git-send-email-toshi.kani@hpe.com>
On Fri, Feb 05, 2016 at 06:40:27PM -0700, Toshi Kani wrote:
> 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: Dan Williams <dan.j.williams@intel.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
Yep, good catch.
Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> ---
> kernel/memremap.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/memremap.c b/kernel/memremap.c
> index 70ee377..3427cca 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;
> }
> _______________________________________________
> Linux-nvdimm mailing list
> Linux-nvdimm@lists.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-02-06 1:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-06 1:40 [PATCH] devm_memremap: Fix error value when memremap failed Toshi Kani
2016-02-06 1:24 ` Ross Zwisler [this message]
2016-02-06 1:49 ` Dan Williams
2016-02-06 1:52 ` Dan Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160206012426.GA12447@linux.intel.com \
--to=ross.zwisler@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nvdimm@lists.01.org \
--cc=toshi.kani@hpe.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox