arch: tile: kernel: kgdb.c: Use memcpy() instead of pointer copy one by one
authorChen Gang <gang.chen.5i5j@gmail.com>
Wed, 12 Nov 2014 02:11:31 +0000 (10:11 +0800)
committerChris Metcalf <cmetcalf@tilera.com>
Wed, 12 Nov 2014 19:27:10 +0000 (14:27 -0500)
commita5c1cb63ddf400cf58c7d8aecd045049f6818279
treec1ef98848041983ce59a4d0ff1677e6c63242b18
parentf47436734dc89ece62654d4db8d08163a89dd7ca
arch: tile: kernel: kgdb.c: Use memcpy() instead of pointer copy one by one

Not only memcpy() is faster than pointer copy, but also let code more
clearer and simple, which can avoid compiling warning (the original
implementation copy registers by exceeding member array border).

The related warning (with allmodconfig under tile):

    CC      arch/tile/kernel/kgdb.o
  arch/tile/kernel/kgdb.c: In function 'sleeping_thread_to_gdb_regs':
  arch/tile/kernel/kgdb.c:140:31: warning: iteration 53u invokes undefined behavior [-Waggressive-loop-optimizations]
     *(ptr++) = thread_regs->regs[reg];
                                 ^
  arch/tile/kernel/kgdb.c:139:2: note: containing loop
    for (reg = 0; reg <= TREG_LAST_GPR; reg++)
    ^

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Chris Metcalf <cmetcalf@ezchip.com>
arch/tile/kernel/kgdb.c