Skip to contentSkip to conversation

atm: clean up vcc_seq_next()

PATCH Applied Dan Carpenter 2 participants 2 messages Feb 14, 2019 – Feb 17, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 atm: clean up vcc_seq_next()

It's confusing to call PTR_ERR(v). The PTR_ERR() function is basically a fancy cast to long so it makes you wonder, was IS_ERR() intended? But that doesn't make sense because vcc_walk() doesn't return error pointers.

This patch doesn't affect runtime, it's just a cleanup.

---
 net/atm/proc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/atm/proc.c +2 -1
index 0b0495a41bbe..d79221fd4dae 100644
@@ -134,7 +134,8 @@ static void vcc_seq_stop(struct seq_file *seq, void *v)
 static void *vcc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 {
 	v = vcc_walk(seq, 1);
-	*pos += !!PTR_ERR(v);
+	if (v)
+		(*pos)++;
 	return v;
 }
 
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw

From: Dan Carpenter <[email protected]>
Date: Thu, 14 Feb 2019 09:56:35 +0300

Quoted 8 lines

It's confusing to call PTR_ERR(v). The PTR_ERR() function is basically a fancy cast to long so it makes you wonder, was IS_ERR() intended? But that doesn't make sense because vcc_walk() doesn't return error pointers.

This patch doesn't affect runtime, it's just a cleanup.

Applied.