linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] openrisc/boot: Remove unnecessary initialisation in memcpy().
@ 2022-01-23  2:01 Kuniyuki Iwashima
  2022-01-23 23:27 ` Stafford Horne
  0 siblings, 1 reply; 4+ messages in thread
From: Kuniyuki Iwashima @ 2022-01-23  2:01 UTC (permalink / raw)
  To: Jonas Bonn, Stefan Kristiansson, Stafford Horne
  Cc: Benjamin Herrenschmidt, Kuniyuki Iwashima, Kuniyuki Iwashima,
	openrisc, linux-kernel

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

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
---
 arch/openrisc/lib/memcpy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/openrisc/lib/memcpy.c b/arch/openrisc/lib/memcpy.c
index fe2177628..e2af9b510 100644
--- a/arch/openrisc/lib/memcpy.c
+++ b/arch/openrisc/lib/memcpy.c
@@ -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 */
-- 
2.30.2


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

* Re: [PATCH] openrisc/boot: Remove unnecessary initialisation in memcpy().
  2022-01-23  2:01 [PATCH] openrisc/boot: Remove unnecessary initialisation in memcpy() Kuniyuki Iwashima
@ 2022-01-23 23:27 ` Stafford Horne
  2022-01-24  0:02   ` Kuniyuki Iwashima
  0 siblings, 1 reply; 4+ messages in thread
From: Stafford Horne @ 2022-01-23 23:27 UTC (permalink / raw)
  To: Kuniyuki Iwashima
  Cc: Jonas Bonn, Stefan Kristiansson, Benjamin Herrenschmidt,
	Kuniyuki Iwashima, openrisc, linux-kernel

On Sun, Jan 23, 2022 at 11:01:00AM +0900, Kuniyuki Iwashima wrote:
> 'd' and 's' are initialised later with 'dest_w' and 'src_w', so we need not
> initialise them before that.
> 
> Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp>

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

Just curious why are you working on OpenRISC?

-Stafford

> ---
>  arch/openrisc/lib/memcpy.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/openrisc/lib/memcpy.c b/arch/openrisc/lib/memcpy.c
> index fe2177628..e2af9b510 100644
> --- a/arch/openrisc/lib/memcpy.c
> +++ b/arch/openrisc/lib/memcpy.c
> @@ -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 */
> -- 
> 2.30.2
> 

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

* Re: [PATCH] openrisc/boot: Remove unnecessary initialisation in memcpy().
  2022-01-23 23:27 ` Stafford Horne
@ 2022-01-24  0:02   ` Kuniyuki Iwashima
  2022-01-24  0:45     ` Stafford Horne
  0 siblings, 1 reply; 4+ messages in thread
From: Kuniyuki Iwashima @ 2022-01-24  0:02 UTC (permalink / raw)
  To: shorne
  Cc: benh, jonas, kuni1840, kuniyu, linux-kernel, openrisc,
	stefan.kristiansson

From:   Stafford Horne <shorne@gmail.com>
Date:   Mon, 24 Jan 2022 08:27:54 +0900
> On Sun, Jan 23, 2022 at 11:01:00AM +0900, Kuniyuki Iwashima wrote:
> > 'd' and 's' are initialised later with 'dest_w' and 'src_w', so we need not
> > initialise them before that.
> > 
> > Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
> 
> This looks fine to me.  I will queue this for the next release.

Thank you.


> 
> 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@amazon.co.jp/


> 
> -Stafford
> 
> > ---
> >  arch/openrisc/lib/memcpy.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/openrisc/lib/memcpy.c b/arch/openrisc/lib/memcpy.c
> > index fe2177628..e2af9b510 100644
> > --- a/arch/openrisc/lib/memcpy.c
> > +++ b/arch/openrisc/lib/memcpy.c
> > @@ -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 */
> > -- 
> > 2.30.2

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

* Re: [PATCH] openrisc/boot: Remove unnecessary initialisation in memcpy().
  2022-01-24  0:02   ` Kuniyuki Iwashima
@ 2022-01-24  0:45     ` Stafford Horne
  0 siblings, 0 replies; 4+ messages in thread
From: Stafford Horne @ 2022-01-24  0:45 UTC (permalink / raw)
  To: Kuniyuki Iwashima
  Cc: benh, jonas, kuni1840, linux-kernel, openrisc,
	stefan.kristiansson

On Mon, Jan 24, 2022 at 09:02:49AM +0900, Kuniyuki Iwashima wrote:
> From:   Stafford Horne <shorne@gmail.com>
> Date:   Mon, 24 Jan 2022 08:27:54 +0900
> > On Sun, Jan 23, 2022 at 11:01:00AM +0900, Kuniyuki Iwashima wrote:
> > > 'd' and 's' are initialised later with 'dest_w' and 'src_w', so we need not
> > > initialise them before that.
> > > 
> > > Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
> > 
> > This looks fine to me.  I will queue this for the next release.
> 
> Thank you.
> 
> 
> > 
> > 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@amazon.co.jp/

Got it.

Thanks again!

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

end of thread, other threads:[~2022-01-24  0:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-23  2:01 [PATCH] openrisc/boot: Remove unnecessary initialisation in memcpy() Kuniyuki Iwashima
2022-01-23 23:27 ` Stafford Horne
2022-01-24  0:02   ` Kuniyuki Iwashima
2022-01-24  0:45     ` Stafford Horne

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).