netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net/smc: delete pointless divide by one
@ 2025-01-08  9:26 Dan Carpenter
  2025-01-08 10:46 ` Simon Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2025-01-08  9:26 UTC (permalink / raw)
  To: Wenjia Zhang
  Cc: Jan Karcher, D. Wythe, Tony Lu, Wen Gu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
	linux-rdma, linux-s390, netdev, linux-kernel, kernel-janitors

Here "buf" is a void pointer so sizeof(*buf) is one.  Doing a divide
by one makes the code less readable.  Delete it.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 net/smc/smc_core.c | 2 +-
 net/smc/smc_rx.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index ccf57b7fe602..ac07b963aede 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -2155,7 +2155,7 @@ static int smcr_buf_map_link(struct smc_buf_desc *buf_desc, bool is_rmb,
 		for_each_sg(buf_desc->sgt[lnk->link_idx].sgl, sg, nents, i) {
 			size = min_t(int, PAGE_SIZE - offset, buf_size);
 			sg_set_page(sg, vmalloc_to_page(buf), size, offset);
-			buf += size / sizeof(*buf);
+			buf += size;
 			buf_size -= size;
 			offset = 0;
 		}
diff --git a/net/smc/smc_rx.c b/net/smc/smc_rx.c
index f0cbe77a80b4..e0ff6ed83057 100644
--- a/net/smc/smc_rx.c
+++ b/net/smc/smc_rx.c
@@ -197,7 +197,7 @@ static int smc_rx_splice(struct pipe_inode_info *pipe, char *src, size_t len,
 			partial[i].offset = offset;
 			partial[i].len = size;
 			partial[i].private = (unsigned long)priv[i];
-			buf += size / sizeof(*buf);
+			buf += size;
 			left -= size;
 			offset = 0;
 		}
-- 
2.45.2


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

* Re: [PATCH net-next] net/smc: delete pointless divide by one
  2025-01-08  9:26 [PATCH net-next] net/smc: delete pointless divide by one Dan Carpenter
@ 2025-01-08 10:46 ` Simon Horman
  2025-01-08 12:16 ` Kalesh Anakkur Purayil
  2025-01-11 21:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2025-01-08 10:46 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Wenjia Zhang, Jan Karcher, D. Wythe, Tony Lu, Wen Gu,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	linux-rdma, linux-s390, netdev, linux-kernel, kernel-janitors

On Wed, Jan 08, 2025 at 12:26:06PM +0300, Dan Carpenter wrote:
> Here "buf" is a void pointer so sizeof(*buf) is one.  Doing a divide
> by one makes the code less readable.  Delete it.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Simon Horman <horms@kernel.org>


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

* Re: [PATCH net-next] net/smc: delete pointless divide by one
  2025-01-08  9:26 [PATCH net-next] net/smc: delete pointless divide by one Dan Carpenter
  2025-01-08 10:46 ` Simon Horman
@ 2025-01-08 12:16 ` Kalesh Anakkur Purayil
  2025-01-11 21:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Kalesh Anakkur Purayil @ 2025-01-08 12:16 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Wenjia Zhang, Jan Karcher, D. Wythe, Tony Lu, Wen Gu,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, linux-rdma, linux-s390, netdev, linux-kernel,
	kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

On Wed, Jan 8, 2025 at 2:56 PM Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> Here "buf" is a void pointer so sizeof(*buf) is one.  Doing a divide
> by one makes the code less readable.  Delete it.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
LGTM,
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>


-- 
Regards,
Kalesh AP

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4239 bytes --]

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

* Re: [PATCH net-next] net/smc: delete pointless divide by one
  2025-01-08  9:26 [PATCH net-next] net/smc: delete pointless divide by one Dan Carpenter
  2025-01-08 10:46 ` Simon Horman
  2025-01-08 12:16 ` Kalesh Anakkur Purayil
@ 2025-01-11 21:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-01-11 21:20 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: wenjia, jaka, alibuda, tonylu, guwen, davem, edumazet, kuba,
	pabeni, horms, linux-rdma, linux-s390, netdev, linux-kernel,
	kernel-janitors

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 8 Jan 2025 12:26:06 +0300 you wrote:
> Here "buf" is a void pointer so sizeof(*buf) is one.  Doing a divide
> by one makes the code less readable.  Delete it.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  net/smc/smc_core.c | 2 +-
>  net/smc/smc_rx.c   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Here is the summary with links:
  - [net-next] net/smc: delete pointless divide by one
    https://git.kernel.org/netdev/net-next/c/10bc9761d12e

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-01-11 21:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-08  9:26 [PATCH net-next] net/smc: delete pointless divide by one Dan Carpenter
2025-01-08 10:46 ` Simon Horman
2025-01-08 12:16 ` Kalesh Anakkur Purayil
2025-01-11 21:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).