[alsa-devel] [PATCH v5] ASoC: Add Freescale SGTL5000 codec support

Timur Tabi timur.tabi at gmail.com
Fri Feb 25 17:13:35 CET 2011

On Fri, Feb 25, 2011 at 9:56 AM, Zeng Zhaoming <zengzm.kernel at 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

More information about the Alsa-devel mailing list