lkml.org 
[lkml]   [2018]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] Suppress the sparse warning ./include/linux/slab.h:332:43: warning: dubious: x & !y
Date
Signed-off-by: Darryl T. Agostinelli <dagostinelli@gmail.com>
---
include/linux/slab.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/linux/slab.h b/include/linux/slab.h
index 918f374e7156..883b7f56bf35 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -317,6 +317,7 @@ static __always_inline enum kmalloc_cache_type kmalloc_type(gfp_t flags)
int is_dma = 0;
int type_dma = 0;
int is_reclaimable;
+ int y;

#ifdef CONFIG_ZONE_DMA
is_dma = !!(flags & __GFP_DMA);
@@ -329,7 +330,10 @@ 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;
+
+ y = (is_reclaimable & (is_dma == 0 ? 1 : 0));
+
+ return type_dma + y * KMALLOC_RECLAIM;
}

/*
--
2.17.1
\
 
 \ /
  Last update: 2018-11-09 03:29    [W:0.044 / U:1.696 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site