Re: [PATCH] ASoC: SDCA: fix __leXX types in find_sdca_control_range
From: Charles Keepax
Date: Mon Jun 22 2026 - 11:17:38 EST
On Mon, Jun 22, 2026 at 02:42:47PM +0100, Ben Dooks wrote:
> The find_sdca_control_range passes u16 and u32 values to the
> leXX_to_cpu() functions. Change this type and for the data
> loop use the le32_to_cpup() to convert the value using a
> pointer.
>
> Fixes the following sparse warnings:
> sound/soc/sdca/sdca_functions.c:868:23: warning: cast to restricted __le16
> sound/soc/sdca/sdca_functions.c:869:23: warning: cast to restricted __le16
> sound/soc/sdca/sdca_functions.c:877:34: warning: cast to restricted __le32
>
> Signed-off-by: Ben Dooks <ben.dooks@xxxxxxxxxxxxxxx>
> ---
> for (i = 0; i < num_range; i++)
> - range->data[i] = le32_to_cpu(range->data[i]);
> + le32_to_cpup((__le32 *)&range->data[i]);
Sorry looking again is this bit right? I think this works because
my system is little endian so this is a no op, but don't you
still need to assign the value here? Or use le32_to_cpus()?
Thanks,
Charles