forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
kernel/sound/firewire/dice/dice-midi.c
....@@ -1,9 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * dice_midi.c - a part of driver for Dice based devices
34 *
45 * Copyright (c) 2014 Takashi Sakamoto
5
- *
6
- * Licensed under the terms of the GNU General Public License, version 2.
76 */
87 #include "dice.h"
98
....@@ -18,8 +17,13 @@
1817
1918 mutex_lock(&dice->mutex);
2019
21
- dice->substreams_counter++;
22
- err = snd_dice_stream_start_duplex(dice, 0);
20
+ err = snd_dice_stream_reserve_duplex(dice, 0, 0, 0);
21
+ if (err >= 0) {
22
+ ++dice->substreams_counter;
23
+ err = snd_dice_stream_start_duplex(dice);
24
+ if (err < 0)
25
+ --dice->substreams_counter;
26
+ }
2327
2428 mutex_unlock(&dice->mutex);
2529
....@@ -35,7 +39,7 @@
3539
3640 mutex_lock(&dice->mutex);
3741
38
- dice->substreams_counter--;
42
+ --dice->substreams_counter;
3943 snd_dice_stream_stop_duplex(dice);
4044
4145 mutex_unlock(&dice->mutex);