diff options
| author | Ajay Agarwal <ajaya@codeaurora.org> | 2017-05-12 11:40:00 +0530 |
|---|---|---|
| committer | Ajay Agarwal <ajaya@codeaurora.org> | 2017-05-12 12:33:15 +0530 |
| commit | 2ecf8c9fd20a4ae805bf8b5acaafc370ffb0943c (patch) | |
| tree | bafe9134d0cc5c66cf652f544572a259e1a4ed0e | |
| parent | ae4d972f07f97de9a368a33820a7fe38284498c2 (diff) | |
sound: usb: Add default branches for BADD 3.0 devices
For a BADD 3.0 device, the Data Endpoint wMaxPacketSize
of an Alt Setting must be one of the values mentioned in
the specifications. Similarly, the unit IDs of the source
units of any entity is prescribed by the specs. Add
support for checking the error(default) branches in the
relevant switch cases and accordingly handle them.
Change-Id: Ib88eee21df012089d41c4e78a161ddc6767e1bd4
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
| -rw-r--r-- | sound/usb/format.c | 5 | ||||
| -rw-r--r-- | sound/usb/mixer.c | 4 | ||||
| -rw-r--r-- | sound/usb/usb_audio_qmi_svc.c | 6 |
3 files changed, 15 insertions, 0 deletions
diff --git a/sound/usb/format.c b/sound/usb/format.c index 2cc3b92f1fba..cb23dd1670b3 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c @@ -90,6 +90,11 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, sample_bytes = SUBSLOTSIZE_24_BIT; break; } + + default: + usb_audio_err(chip, "%u:%d : Invalid wMaxPacketSize\n", + fp->iface, fp->altsetting); + return pcm_formats; } format = 1 << format; break; diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index b9d9d2e99c78..70dfdd22102e 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -1632,6 +1632,10 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, break; } break; + + default: + usb_audio_err(state->chip, "Invalid unit %u\n", unitid); + return -EINVAL; } } diff --git a/sound/usb/usb_audio_qmi_svc.c b/sound/usb/usb_audio_qmi_svc.c index 14ea2239fe11..28c5a3736a9c 100644 --- a/sound/usb/usb_audio_qmi_svc.c +++ b/sound/usb/usb_audio_qmi_svc.c @@ -497,6 +497,12 @@ static int prepare_qmi_response(struct snd_usb_substream *subs, resp->usb_audio_subslot_size = SUBSLOTSIZE_24_BIT; break; } + + default: + pr_err("%d: %u: Invalid wMaxPacketSize\n", + subs->interface, subs->altset_idx); + ret = -EINVAL; + goto err; } resp->usb_audio_subslot_size_valid = 1; } else { |
