From: Richard Fitzgerald Date: Thu, 15 Oct 2020 10:27:03 +0000 (+0100) Subject: ASoC: wm5102: Use get_unaligned_be16() for dac_comp_coeff X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=79405e3e5375875f8edc7dd6c1cf5376b1ded6e7;p=linux.git ASoC: wm5102: Use get_unaligned_be16() for dac_comp_coeff Replace the two-step copy-and-convert in wm5102_out_comp_coeff_put() with get_unaligned_be16(). Apart from looking nicer, it avoids this sparse warning: wm5102.c:687:35: sparse: sparse: cast to restricted __be16 Signed-off-by: Richard Fitzgerald Link: https://lore.kernel.org/r/20201015102703.24622-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c index 2ed3fa67027d0..70d353b63fe03 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c @@ -682,9 +682,7 @@ static int wm5102_out_comp_coeff_put(struct snd_kcontrol *kcontrol, struct arizona *arizona = dev_get_drvdata(component->dev->parent); mutex_lock(&arizona->dac_comp_lock); - memcpy(&arizona->dac_comp_coeff, ucontrol->value.bytes.data, - sizeof(arizona->dac_comp_coeff)); - arizona->dac_comp_coeff = be16_to_cpu(arizona->dac_comp_coeff); + arizona->dac_comp_coeff = get_unaligned_be16(ucontrol->value.bytes.data); mutex_unlock(&arizona->dac_comp_lock); return 0;