@@ -1177,17 +1177,22 @@ static int scarlett2_usb_get_config(
const struct scarlett2_config *config_item =
&scarlett2_config_items[info->has_mixer][config_item_num];
int size, err, i;
+ u8 *buf_8;
u8 value;
/* For byte-sized parameters, retrieve directly into buf */
if (config_item->size >= 8) {
+
size = config_item->size / 8 * count;
err = scarlett2_usb_get(mixer, config_item->offset, buf, size);
if (err < 0)
return err;
- if (size == 2)
- for (i = 0; i < count; i++, (u16 *)buf++)
- *(u16 *)buf = le16_to_cpu(*(__le16 *)buf);
+ if (size == 2) {
+ u16 *buf_16 = buf;
+
+ for (i = 0; i < count; i++, buf_16++)
+ *buf_16 = le16_to_cpu(*(__le16 *)buf_16);
+ }
return 0;
}
@@ -1197,8 +1202,9 @@ static int scarlett2_usb_get_config(
return err;
/* then unpack from value into buf[] */
+ buf_8 = buf;
for (i = 0; i < 8 && i < count; i++, value >>= 1)
- *(u8 *)buf++ = value & 1;
+ *buf_8++ = value & 1;
return 0;
}