linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Darryl T. Agostinelli" <dagostinelli@gmail.com>
To: linux-mm@kvack.org
Cc: cl@linux.com, bvanassche@acm.org, akpm@linux-foundation.org,
	penberg@kernel.org, vbabka@suse.cz, rientjes@google.com,
	iamjoonsoo.kim@lge.com, linux-kernel@vger.kernel.org,
	"Darryl T. Agostinelli" <dagostinelli@gmail.com>
Subject: [PATCH] Suppress the sparse warning ./include/linux/slab.h:332:43: warning: dubious: x & !y
Date: Thu,  8 Nov 2018 20:28:01 -0600	[thread overview]
Message-ID: <20181109022801.29979-1-dagostinelli@gmail.com> (raw)

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

             reply	other threads:[~2018-11-09  2:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09  2:28 Darryl T. Agostinelli [this message]
2018-11-14 22:25 ` [PATCH] Suppress the sparse warning ./include/linux/slab.h:332:43: warning: dubious: x & !y David Rientjes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181109022801.29979-1-dagostinelli@gmail.com \
    --to=dagostinelli@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bvanassche@acm.org \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).