Skip to contentSkip to conversation

Patch "of: silence warnings due to max() usage" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Nov 13, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

of: silence warnings due to max() usage

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
of-silence-warnings-due-to-max-usage.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From aaaab56dba9af4fe75461e0ee13231c1a6ea174d Mon Sep 17 00:00:00 2001

From: Stephen Rothwell <[email protected]>
Date: Tue, 31 May 2016 09:38:56 +1000
Subject: of: silence warnings due to max() usage
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From: Stephen Rothwell <[email protected]>

commit aaaab56dba9af4fe75461e0ee13231c1a6ea174d upstream.

pageblock_order can be (at least) an unsigned int or an unsigned long depending on the kernel config and architecture, so use max_t(unsigned long ...) when comparing it.

fixes these warnings:

In file included from include/linux/list.h:8:0,

                 from include/linux/kobject.h:20,
                 from include/linux/of.h:21,
                 from drivers/of/of_reserved_mem.c:17:
drivers/of/of_reserved_mem.c: In function ‘__reserved_mem_alloc_size’:
include/linux/kernel.h:748:17: warning: comparison of distinct pointer types lacks a cast
  (void) (&_max1 == &_max2);  \
                 ^
include/linux/kernel.h:747:9: note: in definition of macro ‘max’
  typeof(y) _max2 = (y);   \
         ^
drivers/of/of_reserved_mem.c:131:48: note: in expansion of macro ‘max’
   align = max(align, (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_ord
                                                ^
include/linux/kernel.h:748:17: warning: comparison of distinct pointer types lacks a cast
  (void) (&_max1 == &_max2);  \
                 ^
include/linux/kernel.h:747:21: note: in definition of macro ‘max’
  typeof(y) _max2 = (y);   \
                     ^
drivers/of/of_reserved_mem.c:131:48: note: in expansion of macro ‘max’
   align = max(align, (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_ord
                                                ^
Fixes 1cc8e3458b51 ("drivers: of: of_reserved_mem: fixup the alignment with CMA setup")
Cc Arnd Bergmann <[email protected]>
---
 drivers/of/of_reserved_mem.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/of/of_reserved_mem.c +6 -2
@@ -127,8 +127,12 @@ static int __init __reserved_mem_alloc_s
 	}
 
 	/* Need adjust the alignment to satisfy the CMA requirement */
-	if (IS_ENABLED(CONFIG_CMA) && of_flat_dt_is_compatible(node, "shared-dma-pool"))
-		align = max(align, (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order));
+	if (IS_ENABLED(CONFIG_CMA) && of_flat_dt_is_compatible(node, "shared-dma-pool")) {
+		unsigned long order =
+			max_t(unsigned long, MAX_ORDER - 1, pageblock_order);
+
+		align = max(align, (phys_addr_t)PAGE_SIZE << order);
+	}
 
 	prop = of_get_flat_dt_prop(node, "alloc-ranges", &len);
 	if (prop) {

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/of-silence-warnings-due-to-max-usage.patch