25 Feb
2011
25 Feb
'11
4:13 p.m.
On Fri, Feb 25, 2011 at 9:56 AM, Zeng Zhaoming zengzm.kernel@gmail.com wrote:
- memcpy((void *)(&sgtl5000_regs[0] + (SGTL5000_DAP_REG_OFFSET >> 1)),
- sgtl5000_dap_regs,
- SGTL5000_MAX_REG_OFFSET - SGTL5000_DAP_REG_OFFSET);
As has been pointed out on previous revisions of the patch there is no need to cast away from void in C and it can be actively harmful.
I have not remove void* since my toolchain ( gcc 4.4.4) complains about the type mismatch, I will test it with other version toolchain to confirm.
It would probably be simpler if you did this instead:
memcpy((void *)sgtl5000_regs + SGTL5000_DAP_REG_OFFSET,
IMHO, you should be using a struct instead of an array for stgtl5000_regs.
--
Timur Tabi
Linux kernel developer at Freescale