Skip to contentSkip to conversation

openrisc/boot: Remove unnecessary initialisation in memcpy().

PATCH In review Kuniyuki Iwashima 2 participants 4 messages Jan 23, 2022 – Jan 24, 2022 Openrisc architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 openrisc/boot: Remove unnecessary initialisation in memcpy().

'd' and 's' are initialised later with 'dest_w' and 'src_w', so we need not initialise them before that.

---
 arch/openrisc/lib/memcpy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/openrisc/lib/memcpy.c +1 -1
index fe2177628..e2af9b510 100644
@@ -101,7 +101,7 @@ void *memcpy(void *dest, __const void *src, __kernel_size_t n)
  */
 void *memcpy(void *dest, __const void *src, __kernel_size_t n)
 {
-	unsigned char *d = (unsigned char *)dest, *s = (unsigned char *)src;
+	unsigned char *d, *s;
 	uint32_t *dest_w = (uint32_t *)dest, *src_w = (uint32_t *)src;
 
 	/* If both source and dest are word aligned copy words */
Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 4 lines · Kuniyuki Iwashima

'd' and 's' are initialised later with 'dest_w' and 'src_w', so we need not initialise them before that.

This looks fine to me. I will queue this for the next release.

Just curious why are you working on OpenRISC?

-Stafford

Quoted 20 lines
---
 arch/openrisc/lib/memcpy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/openrisc/lib/memcpy.c +1 -1
index fe2177628..e2af9b510 100644
@@ -101,7 +101,7 @@ void *memcpy(void *dest, __const void *src, __kernel_size_t n)
  */
 void *memcpy(void *dest, __const void *src, __kernel_size_t n)
 {
-	unsigned char *d = (unsigned char *)dest, *s = (unsigned char *)src;
+	unsigned char *d, *s;
 	uint32_t *dest_w = (uint32_t *)dest, *src_w = (uint32_t *)src;
 
 	/* If both source and dest are word aligned copy words */
Signature · 1 line
2.30.2
#2 lore raw
From:   Stafford Horne <[email protected]>
Date:   Mon, 24 Jan 2022 08:27:54 +0900
Quoted 7 lines · Kuniyuki Iwashima
Quoted 4 lines

'd' and 's' are initialised later with 'dest_w' and 'src_w', so we need not initialise them before that.

This looks fine to me. I will queue this for the next release.

Thank you.

Quoted 2 lines

Just curious why are you working on OpenRISC?

While reading memcpy() variants, I found a nit to fix in x86 boot-time memcpy() [0]. While I'm at it, I just started reading all arch ones ;)

[0]: https://lore.kernel.org/lkml/20220123015807.45005-1-kuniyu at amazon.co.jp/

Quoted 22 lines

-Stafford

Quoted 19 lines
---
 arch/openrisc/lib/memcpy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/openrisc/lib/memcpy.c +1 -1
index fe2177628..e2af9b510 100644
@@ -101,7 +101,7 @@ void *memcpy(void *dest, __const void *src, __kernel_size_t n)
  */
 void *memcpy(void *dest, __const void *src, __kernel_size_t n)
 {
-	unsigned char *d = (unsigned char *)dest, *s = (unsigned char *)src;
+	unsigned char *d, *s;
 	uint32_t *dest_w = (uint32_t *)dest, *src_w = (uint32_t *)src;
 
 	/* If both source and dest are word aligned copy words */
Signature · 1 line
2.30.2
maintainer
#3 lore raw
Quoted 14 lines · Kuniyuki Iwashima
From:   Stafford Horne <[email protected]>
Date:   Mon, 24 Jan 2022 08:27:54 +0900
Quoted 7 lines · Kuniyuki Iwashima
Quoted 4 lines

'd' and 's' are initialised later with 'dest_w' and 'src_w', so we need not initialise them before that.

This looks fine to me. I will queue this for the next release.

Thank you.

Quoted 1 line
Quoted 6 lines
Quoted 1 line

Just curious why are you working on OpenRISC?

While reading memcpy() variants, I found a nit to fix in x86 boot-time memcpy() [0]. While I'm at it, I just started reading all arch ones ;)

[0]: https://lore.kernel.org/lkml/20220123015807.45005-1-kuniyu at amazon.co.jp/

Got it.

Thanks again!