From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: linux-kernel@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Dan Williams <dan.j.williams@intel.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Robin Murphy <robin.murphy@arm.com>
Subject: [PATCH v1 2/5] dma-mapping: Drop duplicate check for size parameter of memremap()
Date: Fri, 15 Nov 2019 20:00:41 +0200 [thread overview]
Message-ID: <20191115180044.83659-2-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20191115180044.83659-1-andriy.shevchenko@linux.intel.com>
Since memremap() returns NULL pointer for size = 0, there is no need
to duplicate this check in the callers.
Cc: Christoph Hellwig <hch@lst.de>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
kernel/dma/coherent.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/kernel/dma/coherent.c b/kernel/dma/coherent.c
index 551b0eb7028a..7e669c083324 100644
--- a/kernel/dma/coherent.c
+++ b/kernel/dma/coherent.c
@@ -42,16 +42,11 @@ static int dma_init_coherent_memory(phys_addr_t phys_addr,
struct dma_coherent_mem **mem)
{
struct dma_coherent_mem *dma_mem = NULL;
- void *mem_base = NULL;
+ void *mem_base;
int pages = size >> PAGE_SHIFT;
int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long);
int ret;
- if (!size) {
- ret = -EINVAL;
- goto out;
- }
-
mem_base = memremap(phys_addr, size, MEMREMAP_WC);
if (!mem_base) {
ret = -EINVAL;
--
2.24.0
next prev parent reply other threads:[~2019-11-15 18:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-15 18:00 [PATCH v1 1/5] memremap: Check for size parameter Andy Shevchenko
2019-11-15 18:00 ` Andy Shevchenko [this message]
2019-11-16 16:29 ` [PATCH v1 2/5] dma-mapping: Drop duplicate check for size parameter of memremap() Christoph Hellwig
2019-11-15 18:00 ` [PATCH v1 3/5] ALSA: hda: " Andy Shevchenko
2019-11-15 18:00 ` [PATCH v1 4/5] efi/esrt: " Andy Shevchenko
2019-11-15 18:00 ` [PATCH v1 5/5] vfio/pci: " Andy Shevchenko
2019-11-15 22:52 ` Alex Williamson
2019-11-16 16:29 ` [PATCH v1 1/5] memremap: Check for size parameter Christoph Hellwig
2020-04-15 14:58 ` Andy Shevchenko
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=20191115180044.83659-2-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=dan.j.williams@intel.com \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=robin.murphy@arm.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