Skip to contentSkip to conversation

ceph/decode: Remove unnecessary ‘0’ values from ret

PATCH In review Li kunyu 3 participants 3 messages Sep 1, 2023

Subsystems (3)
lore
Share & tools
lore

Li kunyu

author
#0 lore raw

PATCH 1/1 ceph/decode: Remove unnecessary ‘0’ values from ret

ret is assigned first, so it does not need to initialize the assignment.
Bad is not used and can be removed.

---
 net/ceph/decode.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
net/ceph/decode.c +2 -3
index bc109a1a4616..9f5f095d8235 100644
@@ -50,7 +50,7 @@ static int
 ceph_decode_entity_addr_legacy(void **p, void *end,
 			       struct ceph_entity_addr *addr)
 {
-	int ret = -EINVAL;
+	int ret = 0;
 
 	/* Skip rest of type field */
 	ceph_decode_skip_n(p, end, 3, bad);
@@ -66,8 +66,7 @@ ceph_decode_entity_addr_legacy(void **p, void *end,
 			      sizeof(addr->in_addr), bad);
 	addr->in_addr.ss_family =
 			be16_to_cpu((__force __be16)addr->in_addr.ss_family);
-	ret = 0;
-bad:
+
 	return ret;
 }
 
Signature · 1 line
2.18.2
#1 lore raw
Quoted 14 lines · Li kunyu

ret is assigned first, so it does not need to initialize the assignment.
Bad is not used and can be removed.

---
  net/ceph/decode.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
net/ceph/decode.c +0 -0
index bc109a1a4616..9f5f095d8235 100644

net/ceph/decode.c static int · line 56

Quoted 8 lines
net/ceph/decode.c +1 -1
@@ -50,7 +50,7 @@ static int
  ceph_decode_entity_addr_legacy(void **p, void *end,
  			       struct ceph_entity_addr *addr)
  {
-	int ret = -EINVAL;
+	int ret = 0;
 
  	/* Skip rest of type field */
  	ceph_decode_skip_n(p, end, 3, bad);

Hi Kunyu,

The 'bad' lable is used here in this macro.

Thanks

- Xiubo

Quoted 10 lines
net/ceph/decode.c +1 -2
@@ -66,8 +66,7 @@ ceph_decode_entity_addr_legacy(void **p, void *end,
  			      sizeof(addr->in_addr), bad);
  	addr->in_addr.ss_family =
  			be16_to_cpu((__force __be16)addr->in_addr.ss_family);
-	ret = 0;
-bad:
+
  	return ret;
  }
 
reviewer
#2 lore raw
In reply to Li kunyu
Quoted 5 lines · Li kunyu

ret is assigned first, so it does not need to initialize the assignment.
Bad is not used and can be removed.

Hi Li Kunyu,

A few things:

* Your clock seems to be in the future.

* I see you have posted similar similar changes to related code. Please consider combining them into a single patch, or a patch-set.

* Please set the target tree, net-next

Subject: [PATCH net-next] ...

* net-next is currently closed

## Form letter - net-next-closed

The merge window for v6.6 has begun and therefore net-next is closed for new drivers, features, code refactoring and optimizations. We are currently accepting bug fixes only.

Please repost when net-next reopens after Sept 11th.

RFC patches sent for review only are obviously welcome at any time.

See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
--
pw-bot: defer