Merge remote-tracking branch 'common/android-4.9' into hikey-4.9
Change-Id: Ib72a79566fc44bd93c2901b60daa16242ecb4053
This commit is contained in:
@@ -264,8 +264,10 @@ static void update_audio_tstamp(struct snd_pcm_substream *substream,
|
||||
runtime->rate);
|
||||
*audio_tstamp = ns_to_timespec(audio_nsecs);
|
||||
}
|
||||
runtime->status->audio_tstamp = *audio_tstamp;
|
||||
runtime->status->tstamp = *curr_tstamp;
|
||||
if (!timespec_equal(&runtime->status->audio_tstamp, audio_tstamp)) {
|
||||
runtime->status->audio_tstamp = *audio_tstamp;
|
||||
runtime->status->tstamp = *curr_tstamp;
|
||||
}
|
||||
|
||||
/*
|
||||
* re-take a driver timestamp to let apps detect if the reference tstamp
|
||||
|
||||
@@ -66,11 +66,11 @@ static int snd_timer_user_info_compat(struct file *file,
|
||||
struct snd_timer *t;
|
||||
|
||||
tu = file->private_data;
|
||||
if (snd_BUG_ON(!tu->timeri))
|
||||
return -ENXIO;
|
||||
if (!tu->timeri)
|
||||
return -EBADFD;
|
||||
t = tu->timeri->timer;
|
||||
if (snd_BUG_ON(!t))
|
||||
return -ENXIO;
|
||||
if (!t)
|
||||
return -EBADFD;
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.card = t->card ? t->card->number : -1;
|
||||
if (t->hw.flags & SNDRV_TIMER_HW_SLAVE)
|
||||
@@ -99,8 +99,8 @@ static int snd_timer_user_status_compat(struct file *file,
|
||||
struct snd_timer_status32 status;
|
||||
|
||||
tu = file->private_data;
|
||||
if (snd_BUG_ON(!tu->timeri))
|
||||
return -ENXIO;
|
||||
if (!tu->timeri)
|
||||
return -EBADFD;
|
||||
memset(&status, 0, sizeof(status));
|
||||
status.tstamp.tv_sec = tu->tstamp.tv_sec;
|
||||
status.tstamp.tv_nsec = tu->tstamp.tv_nsec;
|
||||
|
||||
@@ -746,7 +746,7 @@ static int hdmi_chmap_ctl_get(struct snd_kcontrol *kcontrol,
|
||||
memset(pcm_chmap, 0, sizeof(pcm_chmap));
|
||||
chmap->ops.get_chmap(chmap->hdac, pcm_idx, pcm_chmap);
|
||||
|
||||
for (i = 0; i < sizeof(chmap); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(pcm_chmap); i++)
|
||||
ucontrol->value.integer.value[i] = pcm_chmap[i];
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -2305,6 +2305,9 @@ static const struct pci_device_id azx_ids[] = {
|
||||
/* AMD Hudson */
|
||||
{ PCI_DEVICE(0x1022, 0x780d),
|
||||
.driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB },
|
||||
/* AMD Raven */
|
||||
{ PCI_DEVICE(0x1022, 0x15e3),
|
||||
.driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB },
|
||||
/* ATI HDMI */
|
||||
{ PCI_DEVICE(0x1002, 0x0002),
|
||||
.driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS },
|
||||
|
||||
@@ -4419,7 +4419,7 @@ static void alc_no_shutup(struct hda_codec *codec)
|
||||
static void alc_fixup_no_shutup(struct hda_codec *codec,
|
||||
const struct hda_fixup *fix, int action)
|
||||
{
|
||||
if (action == HDA_FIXUP_ACT_PRE_PROBE) {
|
||||
if (action == HDA_FIXUP_ACT_PROBE) {
|
||||
struct alc_spec *spec = codec->spec;
|
||||
spec->shutup = alc_no_shutup;
|
||||
}
|
||||
@@ -6272,7 +6272,7 @@ static int patch_alc269(struct hda_codec *codec)
|
||||
case 0x10ec0703:
|
||||
spec->codec_variant = ALC269_TYPE_ALC700;
|
||||
spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
|
||||
alc_update_coef_idx(codec, 0x4a, 0, 1 << 15); /* Combo jack auto trigger control */
|
||||
alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
@@ -1365,7 +1365,7 @@ static int wm_adsp_load(struct wm_adsp *dsp)
|
||||
const struct wmfw_region *region;
|
||||
const struct wm_adsp_region *mem;
|
||||
const char *region_name;
|
||||
char *file, *text;
|
||||
char *file, *text = NULL;
|
||||
struct wm_adsp_buf *buf;
|
||||
unsigned int reg;
|
||||
int regions = 0;
|
||||
@@ -1526,10 +1526,21 @@ static int wm_adsp_load(struct wm_adsp *dsp)
|
||||
regions, le32_to_cpu(region->len), offset,
|
||||
region_name);
|
||||
|
||||
if ((pos + le32_to_cpu(region->len) + sizeof(*region)) >
|
||||
firmware->size) {
|
||||
adsp_err(dsp,
|
||||
"%s.%d: %s region len %d bytes exceeds file length %zu\n",
|
||||
file, regions, region_name,
|
||||
le32_to_cpu(region->len), firmware->size);
|
||||
ret = -EINVAL;
|
||||
goto out_fw;
|
||||
}
|
||||
|
||||
if (text) {
|
||||
memcpy(text, region->data, le32_to_cpu(region->len));
|
||||
adsp_info(dsp, "%s: %s\n", file, text);
|
||||
kfree(text);
|
||||
text = NULL;
|
||||
}
|
||||
|
||||
if (reg) {
|
||||
@@ -1574,6 +1585,7 @@ out_fw:
|
||||
regmap_async_complete(regmap);
|
||||
wm_adsp_buf_free(&buf_list);
|
||||
release_firmware(firmware);
|
||||
kfree(text);
|
||||
out:
|
||||
kfree(file);
|
||||
|
||||
@@ -2054,6 +2066,17 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
|
||||
}
|
||||
|
||||
if (reg) {
|
||||
if ((pos + le32_to_cpu(blk->len) + sizeof(*blk)) >
|
||||
firmware->size) {
|
||||
adsp_err(dsp,
|
||||
"%s.%d: %s region len %d bytes exceeds file length %zu\n",
|
||||
file, blocks, region_name,
|
||||
le32_to_cpu(blk->len),
|
||||
firmware->size);
|
||||
ret = -EINVAL;
|
||||
goto out_fw;
|
||||
}
|
||||
|
||||
buf = wm_adsp_buf_alloc(blk->data,
|
||||
le32_to_cpu(blk->len),
|
||||
&buf_list);
|
||||
|
||||
@@ -978,10 +978,8 @@ static int __rsnd_kctrl_new(struct rsnd_mod *mod,
|
||||
return -ENOMEM;
|
||||
|
||||
ret = snd_ctl_add(card, kctrl);
|
||||
if (ret < 0) {
|
||||
snd_ctl_free_one(kctrl);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
cfg->update = update;
|
||||
cfg->card = card;
|
||||
|
||||
+6
-3
@@ -43,7 +43,7 @@ static struct uac_clock_source_descriptor *
|
||||
while ((cs = snd_usb_find_csint_desc(ctrl_iface->extra,
|
||||
ctrl_iface->extralen,
|
||||
cs, UAC2_CLOCK_SOURCE))) {
|
||||
if (cs->bClockID == clock_id)
|
||||
if (cs->bLength >= sizeof(*cs) && cs->bClockID == clock_id)
|
||||
return cs;
|
||||
}
|
||||
|
||||
@@ -59,8 +59,11 @@ static struct uac_clock_selector_descriptor *
|
||||
while ((cs = snd_usb_find_csint_desc(ctrl_iface->extra,
|
||||
ctrl_iface->extralen,
|
||||
cs, UAC2_CLOCK_SELECTOR))) {
|
||||
if (cs->bClockID == clock_id)
|
||||
if (cs->bLength >= sizeof(*cs) && cs->bClockID == clock_id) {
|
||||
if (cs->bLength < 5 + cs->bNrInPins)
|
||||
return NULL;
|
||||
return cs;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -75,7 +78,7 @@ static struct uac_clock_multiplier_descriptor *
|
||||
while ((cs = snd_usb_find_csint_desc(ctrl_iface->extra,
|
||||
ctrl_iface->extralen,
|
||||
cs, UAC2_CLOCK_MULTIPLIER))) {
|
||||
if (cs->bClockID == clock_id)
|
||||
if (cs->bLength >= sizeof(*cs) && cs->bClockID == clock_id)
|
||||
return cs;
|
||||
}
|
||||
|
||||
|
||||
+14
-1
@@ -1463,6 +1463,12 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid,
|
||||
__u8 *bmaControls;
|
||||
|
||||
if (state->mixer->protocol == UAC_VERSION_1) {
|
||||
if (hdr->bLength < 7) {
|
||||
usb_audio_err(state->chip,
|
||||
"unit %u: invalid UAC_FEATURE_UNIT descriptor\n",
|
||||
unitid);
|
||||
return -EINVAL;
|
||||
}
|
||||
csize = hdr->bControlSize;
|
||||
if (!csize) {
|
||||
usb_audio_dbg(state->chip,
|
||||
@@ -1480,6 +1486,12 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid,
|
||||
}
|
||||
} else {
|
||||
struct uac2_feature_unit_descriptor *ftr = _ftr;
|
||||
if (hdr->bLength < 6) {
|
||||
usb_audio_err(state->chip,
|
||||
"unit %u: invalid UAC_FEATURE_UNIT descriptor\n",
|
||||
unitid);
|
||||
return -EINVAL;
|
||||
}
|
||||
csize = 4;
|
||||
channels = (hdr->bLength - 6) / 4 - 1;
|
||||
bmaControls = ftr->bmaControls;
|
||||
@@ -2080,7 +2092,8 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid,
|
||||
const struct usbmix_name_map *map;
|
||||
char **namelist;
|
||||
|
||||
if (!desc->bNrInPins || desc->bLength < 5 + desc->bNrInPins) {
|
||||
if (desc->bLength < 5 || !desc->bNrInPins ||
|
||||
desc->bLength < 5 + desc->bNrInPins) {
|
||||
usb_audio_err(state->chip,
|
||||
"invalid SELECTOR UNIT descriptor %d\n", unitid);
|
||||
return -EINVAL;
|
||||
|
||||
Reference in New Issue
Block a user