All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] slab.h: Avoid using & for logical and of booleans
@ 2018-11-05 20:40 Bart Van Assche
  2018-11-05 21:13 ` Andrew Morton
                   ` (3 more replies)
  0 siblings, 4 replies; 32+ messages in thread
From: Bart Van Assche @ 2018-11-05 20:40 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, Bart Van Assche, Vlastimil Babka, Mel Gorman,
	Christoph Lameter, Roman Gushchin

This patch suppresses the following sparse warning:

./include/linux/slab.h:332:43: warning: dubious: x & !y

Fixes: 1291523f2c1d ("mm, slab/slub: introduce kmalloc-reclaimable caches")
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Christoph Lameter <cl@linux.com>
Cc: Roman Gushchin <guro@fb.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 include/linux/slab.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/slab.h b/include/linux/slab.h
index 918f374e7156..97d0599ddb7b 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -329,7 +329,7 @@ static __always_inline enum kmalloc_cache_type kmalloc_type(gfp_t flags)
 	 * If an allocation is both __GFP_DMA and __GFP_RECLAIMABLE, return
 	 * KMALLOC_DMA and effectively ignore __GFP_RECLAIMABLE
 	 */
-	return type_dma + (is_reclaimable & !is_dma) * KMALLOC_RECLAIM;
+	return type_dma + is_reclaimable * !is_dma * KMALLOC_RECLAIM;
 }
 
 /*
-- 
2.19.1.930.g4563a0d9d0-goog


^ permalink raw reply related	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2018-11-21 13:22 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-05 20:40 [PATCH] slab.h: Avoid using & for logical and of booleans Bart Van Assche
2018-11-05 21:13 ` Andrew Morton
2018-11-05 21:48   ` Bart Van Assche
2018-11-05 21:48     ` Bart Van Assche
2018-11-05 22:14     ` Rasmus Villemoes
2018-11-05 22:40       ` Bart Van Assche
2018-11-05 22:48         ` Alexander Duyck
2018-11-06  0:01           ` Bart Van Assche
2018-11-06  0:11             ` Alexander Duyck
2018-11-06  0:32               ` Bart Van Assche
2018-11-06 17:20                 ` Alexander Duyck
2018-11-06 17:48                   ` Bart Van Assche
2018-11-06 17:48                     ` Bart Van Assche
2018-11-06 18:17                     ` Alexander Duyck
2018-11-06  9:45   ` William Kucharski
2018-11-06  8:40 ` Vlastimil Babka
2018-11-06 10:08 ` David Laight
2018-11-06 10:22   ` Vlastimil Babka
2018-11-06 11:07     ` David Laight
2018-11-06 12:51       ` Vlastimil Babka
2018-11-07 10:41         ` David Laight
2018-11-09  8:12           ` Vlastimil Babka
2018-11-09 19:00             ` Andrew Morton
2018-11-09 19:16               ` Vlastimil Babka
2018-11-09 19:47                 ` Darryl T. Agostinelli
2018-11-09 21:31                   ` Vlastimil Babka
2018-11-12  9:55                 ` David Laight
2018-11-13 18:22                   ` Vlastimil Babka
2018-11-21 13:22                     ` Vlastimil Babka
2018-11-21 13:22                       ` Vlastimil Babka
2018-11-19 11:04 ` Pavel Machek
2018-11-19 12:51   ` Vlastimil Babka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.