Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1578219

[PATCH] ipc/mqueue: use unsigned int for retval

From Nicholas Mc Guire <der.herr@hofr.at>
Newsgroups linux.kernel
Subject [PATCH] ipc/mqueue: use unsigned int for retval
Date 2017-02-10 08:40 +0100
Message-ID <t9dYd-q5-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


The retval variable is assigned by bitops only and thus there is no
reason to use a signed type. Further matching it with the return 
type of the function also makes static code checkers happy.

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---

Found by experimental type-checking coccinelle script

Patch was compile tested with: x86_64_defconfig

Patch is against 4.10-rc6 (localversion-next is next-20170209)

 ipc/mqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 4fdd970..897ce70 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -519,7 +519,7 @@ static int mqueue_flush_file(struct file *filp, fl_owner_t id)
 static unsigned int mqueue_poll_file(struct file *filp, struct poll_table_struct *poll_tab)
 {
 	struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp));
-	int retval = 0;
+	unsigned int retval = 0;
 
 	poll_wait(filp, &info->wait_q, poll_tab);
 
-- 
2.1.4

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] ipc/mqueue: use unsigned int for retval Nicholas Mc Guire <der.herr@hofr.at> - 2017-02-10 08:40 +0100
  Re: [PATCH] ipc/mqueue: use unsigned int for retval Waiman Long <longman@redhat.com> - 2017-02-10 16:40 +0100

csiph-web