Commit 3acaea68 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

mm/cma.c: suppress warning

mm/cma.c: In function 'cma_alloc':
mm/cma.c:366: warning: 'pfn' may be used uninitialized in this function

The patch actually improves the tracing a bit: if alloc_contig_range()
fails, tracing will display the offending pfn rather than -1.

Cc: Stefan Strogin <stefan.strogin@gmail.com>
Cc: Michal Nazarewicz <mpn@google.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 42cb14b1
...@@ -363,7 +363,9 @@ int __init cma_declare_contiguous(phys_addr_t base, ...@@ -363,7 +363,9 @@ int __init cma_declare_contiguous(phys_addr_t base,
*/ */
struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align) struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align)
{ {
unsigned long mask, offset, pfn, start = 0; unsigned long mask, offset;
unsigned long pfn = -1;
unsigned long start = 0;
unsigned long bitmap_maxno, bitmap_no, bitmap_count; unsigned long bitmap_maxno, bitmap_no, bitmap_count;
struct page *page = NULL; struct page *page = NULL;
int ret; int ret;
...@@ -418,7 +420,7 @@ struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align) ...@@ -418,7 +420,7 @@ struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align)
start = bitmap_no + mask + 1; start = bitmap_no + mask + 1;
} }
trace_cma_alloc(page ? pfn : -1UL, page, count, align); trace_cma_alloc(pfn, page, count, align);
pr_debug("%s(): returned %p\n", __func__, page); pr_debug("%s(): returned %p\n", __func__, page);
return page; return page;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment