Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ALSA: asihpi: Simplify error handling in PCM substream setup

Refactor error handling in the PCM substream setup to combine redundant
checks and improve code readability. Free the dpcm structure and return
appropriate error codes (-EBUSY for HPI_ERROR_OBJ_ALREADY_OPEN, -EIO
for other errors) in a single block.

Signed-off-by: Jihed Chaibi <jihed.chaibi.dev@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Jihed Chaibi and committed by
Takashi Iwai
c29287bb e135eeef

+8 -8
+8 -8
sound/pci/asihpi/asihpi.c
··· 982 982 err = hpi_outstream_open(card->hpi->adapter->index, 983 983 substream->number, &dpcm->h_stream); 984 984 hpi_handle_error(err); 985 - if (err) 985 + if (err) { 986 986 kfree(dpcm); 987 - if (err == HPI_ERROR_OBJ_ALREADY_OPEN) 988 - return -EBUSY; 989 - if (err) 987 + if (err == HPI_ERROR_OBJ_ALREADY_OPEN) 988 + return -EBUSY; 990 989 return -EIO; 990 + } 991 991 992 992 /*? also check ASI5000 samplerate source 993 993 If external, only support external rate. ··· 1156 1156 err = hpi_handle_error( 1157 1157 hpi_instream_open(card->hpi->adapter->index, 1158 1158 substream->number, &dpcm->h_stream)); 1159 - if (err) 1159 + if (err) { 1160 1160 kfree(dpcm); 1161 - if (err == HPI_ERROR_OBJ_ALREADY_OPEN) 1162 - return -EBUSY; 1163 - if (err) 1161 + if (err == HPI_ERROR_OBJ_ALREADY_OPEN) 1162 + return -EBUSY; 1164 1163 return -EIO; 1164 + } 1165 1165 1166 1166 timer_setup(&dpcm->timer, snd_card_asihpi_timer_function, 0); 1167 1167 dpcm->substream = substream;