ASoC: nau8822: Fix incorrect type in assignment and cast to restricted __be16
[platform/kernel/linux-rpi.git] / sound / soc / codecs / nau8822.c
index ff30248..7199d73 100644 (file)
@@ -184,6 +184,7 @@ static int nau8822_eq_get(struct snd_kcontrol *kcontrol,
        struct soc_bytes_ext *params = (void *)kcontrol->private_value;
        int i, reg;
        u16 reg_val, *val;
+       __be16 tmp;
 
        val = (u16 *)ucontrol->value.bytes.data;
        reg = NAU8822_REG_EQ1;
@@ -192,8 +193,8 @@ static int nau8822_eq_get(struct snd_kcontrol *kcontrol,
                /* conversion of 16-bit integers between native CPU format
                 * and big endian format
                 */
-               reg_val = cpu_to_be16(reg_val);
-               memcpy(val + i, &reg_val, sizeof(reg_val));
+               tmp = cpu_to_be16(reg_val);
+               memcpy(val + i, &tmp, sizeof(tmp));
        }
 
        return 0;
@@ -216,6 +217,7 @@ static int nau8822_eq_put(struct snd_kcontrol *kcontrol,
        void *data;
        u16 *val, value;
        int i, reg, ret;
+       __be16 *tmp;
 
        data = kmemdup(ucontrol->value.bytes.data,
                params->max, GFP_KERNEL | GFP_DMA);
@@ -228,7 +230,8 @@ static int nau8822_eq_put(struct snd_kcontrol *kcontrol,
                /* conversion of 16-bit integers between native CPU format
                 * and big endian format
                 */
-               value = be16_to_cpu(*(val + i));
+               tmp = (__be16 *)(val + i);
+               value = be16_to_cpup(tmp);
                ret = snd_soc_component_write(component, reg + i, value);
                if (ret) {
                        dev_err(component->dev,