Re: [PATCH] ceph/decode: Remove unnecessary ‘0’ values from ret

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le 01/09/2023 à 05:40, Li kunyu a écrit :
ret is assigned first, so it does not need to initialize the
assignment.
Bad is not used and can be removed.

Signed-off-by: Li kunyu <kunyu@xxxxxxxxxxxx>
---
  net/ceph/decode.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/ceph/decode.c b/net/ceph/decode.c
index bc109a1a4616..9f5f095d8235 100644
--- a/net/ceph/decode.c
+++ b/net/ceph/decode.c
@@ -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;
  }

This patch is wrong.
Look how the ceph_decode_skip_n() macro, for example, is expended.
You'll see that 'bad' is needed.

I think that your patch was not compile tested.

Please do not send patch that are not at least compile tested. Even when it looks obvious.

CJ



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux