Netdev List
 help / color / mirror / Atom feed
* [PATCH] net/rxrpc: Simplify rxrpcpeerseq_next()
@ 2026-10-15 20:01 Chelsy Ratnawat
  2026-10-16  5:59 ` kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Chelsy Ratnawat @ 2026-10-15 20:01 UTC (permalink / raw)
  To: dhowells, davem, marc.dionne; +Cc: netdev, Chelsy Ratnawat

Remove the redundant initialization and conditional handling of n,
as it is always set to 1. Use the constant directly when updating
*_pos and starting the hlist iteration.

Signed-off-by: Chelsy Ratnawat <chelsyratnawat2001@gmail.com>
---
 net/rxrpc/proc.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/net/rxrpc/proc.c b/net/rxrpc/proc.c
index e9a27fa7b25d..608670dc97d9 100644
--- a/net/rxrpc/proc.c
+++ b/net/rxrpc/proc.c
@@ -367,19 +367,14 @@ static void *rxrpc_peer_seq_next(struct seq_file *seq, void *v, loff_t *_pos)
 
 	for (;;) {
 		bucket++;
-		n = 1;
-		*_pos = (bucket << shift) | n;
+		*_pos = (bucket << shift) | 1;
 
 		if (bucket >= HASH_SIZE(rxnet->peer_hash)) {
 			*_pos = UINT_MAX;
 			return NULL;
 		}
-		if (n == 0) {
-			*_pos += 1;
-			n++;
-		}
 
-		p = seq_hlist_start_rcu(&rxnet->peer_hash[bucket], n - 1);
+		p = seq_hlist_start_rcu(&rxnet->peer_hash[bucket], 0);
 		if (p)
 			return p;
 	}
-- 
2.53.0


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

* Re: [PATCH] net/rxrpc: Simplify rxrpcpeerseq_next()
  2026-10-15 20:01 [PATCH] net/rxrpc: Simplify rxrpcpeerseq_next() Chelsy Ratnawat
@ 2026-10-16  5:59 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-10-16  5:59 UTC (permalink / raw)
  To: Chelsy Ratnawat, dhowells, davem, marc.dionne
  Cc: oe-kbuild-all, netdev, Chelsy Ratnawat

Hi Chelsy,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]
[also build test WARNING on net/main linus/master dhowells-fs/fscache-next dhowells-fs/keys-next v7.3-rc7 next-20261012]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Chelsy-Ratnawat/net-rxrpc-Simplify-rxrpcpeerseq_next/20261015-130115
base:   net-next/main
patch link:    https://lore.kernel.org/r/20261015200115.59571-1-chelsyratnawat2001%40gmail.com
patch subject: [PATCH] net/rxrpc: Simplify rxrpcpeerseq_next()
config: nios2-randconfig-1000-20261016 (https://download.01.org/0day-ci/archive/20261016/202610161338.9QHAZ7bn-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261016/202610161338.9QHAZ7bn-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202610161338.9QHAZ7bn-lkp@intel.com/

All warnings (new ones prefixed by >>):

   net/rxrpc/proc.c: In function 'rxrpc_peer_seq_next':
>> net/rxrpc/proc.c:355:30: warning: unused variable 'n' [-Wunused-variable]
     355 |         unsigned int bucket, n;
         |                              ^


vim +/n +355 net/rxrpc/proc.c

bc0e7cf43370a8e David Howells   2018-10-15  351  
bc0e7cf43370a8e David Howells   2018-10-15  352  static void *rxrpc_peer_seq_next(struct seq_file *seq, void *v, loff_t *_pos)
bc0e7cf43370a8e David Howells   2018-10-15  353  {
bc0e7cf43370a8e David Howells   2018-10-15  354  	struct rxrpc_net *rxnet = rxrpc_net(seq_file_net(seq));
bc0e7cf43370a8e David Howells   2018-10-15 @355  	unsigned int bucket, n;
bc0e7cf43370a8e David Howells   2018-10-15  356  	unsigned int shift = 32 - HASH_BITS(rxnet->peer_hash);
bc0e7cf43370a8e David Howells   2018-10-15  357  	void *p;
bc0e7cf43370a8e David Howells   2018-10-15  358  
bc0e7cf43370a8e David Howells   2018-10-15  359  	if (*_pos >= UINT_MAX)
bc0e7cf43370a8e David Howells   2018-10-15  360  		return NULL;
bc0e7cf43370a8e David Howells   2018-10-15  361  
bc0e7cf43370a8e David Howells   2018-10-15  362  	bucket = *_pos >> shift;
bc0e7cf43370a8e David Howells   2018-10-15  363  
bc0e7cf43370a8e David Howells   2018-10-15  364  	p = seq_hlist_next_rcu(v, &rxnet->peer_hash[bucket], _pos);
bc0e7cf43370a8e David Howells   2018-10-15  365  	if (p)
bc0e7cf43370a8e David Howells   2018-10-15  366  		return p;
bc0e7cf43370a8e David Howells   2018-10-15  367  
bc0e7cf43370a8e David Howells   2018-10-15  368  	for (;;) {
bc0e7cf43370a8e David Howells   2018-10-15  369  		bucket++;
da940c1bf91ae9e Chelsy Ratnawat 2026-10-15  370  		*_pos = (bucket << shift) | 1;
bc0e7cf43370a8e David Howells   2018-10-15  371  
bc0e7cf43370a8e David Howells   2018-10-15  372  		if (bucket >= HASH_SIZE(rxnet->peer_hash)) {
bc0e7cf43370a8e David Howells   2018-10-15  373  			*_pos = UINT_MAX;
bc0e7cf43370a8e David Howells   2018-10-15  374  			return NULL;
bc0e7cf43370a8e David Howells   2018-10-15  375  		}
bc0e7cf43370a8e David Howells   2018-10-15  376  
da940c1bf91ae9e Chelsy Ratnawat 2026-10-15  377  		p = seq_hlist_start_rcu(&rxnet->peer_hash[bucket], 0);
bc0e7cf43370a8e David Howells   2018-10-15  378  		if (p)
bc0e7cf43370a8e David Howells   2018-10-15  379  			return p;
bc0e7cf43370a8e David Howells   2018-10-15  380  	}
bc0e7cf43370a8e David Howells   2018-10-15  381  }
bc0e7cf43370a8e David Howells   2018-10-15  382  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2026-10-16  5:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-15 20:01 [PATCH] net/rxrpc: Simplify rxrpcpeerseq_next() Chelsy Ratnawat
2026-10-16  5:59 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox