From 547e631ce3886175a33b5ccf67729bdd18e9b7e0 Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Sat, 19 Sep 2015 11:21:49 +0900 Subject: ALSA: firewire-lib: return error code when amdtp_stream_set_parameters() detects error Currently, amdtp_stream_set_parameters() returns no error even if wrong arguments are given. This is not good for streaming layer because drivers can continue processing ignoring capability of streaming layer. This commit changes this function to return error code. Signed-off-by: Takashi Sakamoto Signed-off-by: Takashi Iwai --- sound/firewire/bebob/bebob_stream.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'sound/firewire/bebob') diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c index 5be5242e1ed8..c642b79e7ed4 100644 --- a/sound/firewire/bebob/bebob_stream.c +++ b/sound/firewire/bebob/bebob_stream.c @@ -427,12 +427,17 @@ make_both_connections(struct snd_bebob *bebob, unsigned int rate) index = get_formation_index(rate); pcm_channels = bebob->tx_stream_formations[index].pcm; midi_channels = bebob->tx_stream_formations[index].midi; - amdtp_stream_set_parameters(&bebob->tx_stream, - rate, pcm_channels, midi_channels * 8); + err = amdtp_stream_set_parameters(&bebob->tx_stream, rate, + pcm_channels, midi_channels * 8); + if (err < 0) + goto end; + pcm_channels = bebob->rx_stream_formations[index].pcm; midi_channels = bebob->rx_stream_formations[index].midi; - amdtp_stream_set_parameters(&bebob->rx_stream, - rate, pcm_channels, midi_channels * 8); + err = amdtp_stream_set_parameters(&bebob->rx_stream, rate, + pcm_channels, midi_channels * 8); + if (err < 0) + goto end; /* establish connections for both streams */ err = cmp_connection_establish(&bebob->out_conn, -- cgit