From: Andrew Morton Date: Fri, 6 Nov 2015 02:50:08 +0000 (-0800) Subject: mm/cma.c: suppress warning X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=3acaea6804b3a10e996ce6ebc342089f481e1cdb;p=openwrt%2Fstaging%2Fblogic.git 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 Cc: Michal Nazarewicz Cc: Marek Szyprowski Cc: Laurent Pinchart Cc: Thierry Reding Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/cma.c b/mm/cma.c index 4eb56badf37e..ea506eb18cd6 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -363,7 +363,9 @@ err: */ 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; struct page *page = NULL; int ret; @@ -418,7 +420,7 @@ struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align) 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); return page;