Skip to content

Commit bf0bc44

Browse files
HiassofTPhil Elwell
authored and
Phil Elwell
committed
ASoC: bcm: add missing .owner fields in sound card drivers
If snd_soc_card.owner is not set the kernel won't do usage refcounting and one can remove the card driver module while it's in use (eg playback active) - which leads to a kernel crash. The missing owner field also prevents ALSA slot ordering (options snd slots=module-name1,module-name-2,...) from working with the I2S cards as it has no module name to match against. Fix these issues by setting the .owner field in the snd_soc_card structs. Signed-off-by: Matthias Reichl <[email protected]>
1 parent 2917226 commit bf0bc44

8 files changed

+8
-0
lines changed

sound/soc/bcm/hifiberry_amp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_amp_dai[] = {
6161

6262
static struct snd_soc_card snd_rpi_hifiberry_amp = {
6363
.name = "snd_rpi_hifiberry_amp",
64+
.owner = THIS_MODULE,
6465
.dai_link = snd_rpi_hifiberry_amp_dai,
6566
.num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai),
6667
};

sound/soc/bcm/hifiberry_dac.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_dac_dai[] = {
6363
/* audio machine driver */
6464
static struct snd_soc_card snd_rpi_hifiberry_dac = {
6565
.name = "snd_rpi_hifiberry_dac",
66+
.owner = THIS_MODULE,
6667
.dai_link = snd_rpi_hifiberry_dac_dai,
6768
.num_links = ARRAY_SIZE(snd_rpi_hifiberry_dac_dai),
6869
};

sound/soc/bcm/hifiberry_dacplus.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_dacplus_dai[] = {
288288
/* audio machine driver */
289289
static struct snd_soc_card snd_rpi_hifiberry_dacplus = {
290290
.name = "snd_rpi_hifiberry_dacplus",
291+
.owner = THIS_MODULE,
291292
.dai_link = snd_rpi_hifiberry_dacplus_dai,
292293
.num_links = ARRAY_SIZE(snd_rpi_hifiberry_dacplus_dai),
293294
};

sound/soc/bcm/hifiberry_digi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_digi_dai[] = {
164164
/* audio machine driver */
165165
static struct snd_soc_card snd_rpi_hifiberry_digi = {
166166
.name = "snd_rpi_hifiberry_digi",
167+
.owner = THIS_MODULE,
167168
.dai_link = snd_rpi_hifiberry_digi_dai,
168169
.num_links = ARRAY_SIZE(snd_rpi_hifiberry_digi_dai),
169170
};

sound/soc/bcm/iqaudio-dac.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ static struct snd_soc_dai_link snd_rpi_iqaudio_dac_dai[] = {
7878
/* audio machine driver */
7979
static struct snd_soc_card snd_rpi_iqaudio_dac = {
8080
.name = "IQaudIODAC",
81+
.owner = THIS_MODULE,
8182
.dai_link = snd_rpi_iqaudio_dac_dai,
8283
.num_links = ARRAY_SIZE(snd_rpi_iqaudio_dac_dai),
8384
};

sound/soc/bcm/raspidac3.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ static struct snd_soc_dai_link snd_rpi_raspidac3_dai[] = {
128128
/* audio machine driver */
129129
static struct snd_soc_card snd_rpi_raspidac3 = {
130130
.name = "RaspiDAC Rev.3x HiFi Audio Card",
131+
.owner = THIS_MODULE,
131132
.dai_link = snd_rpi_raspidac3_dai,
132133
.num_links = ARRAY_SIZE(snd_rpi_raspidac3_dai),
133134
};

sound/soc/bcm/rpi-dac.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ static struct snd_soc_dai_link snd_rpi_rpi_dac_dai[] = {
6060
/* audio machine driver */
6161
static struct snd_soc_card snd_rpi_rpi_dac = {
6262
.name = "snd_rpi_rpi_dac",
63+
.owner = THIS_MODULE,
6364
.dai_link = snd_rpi_rpi_dac_dai,
6465
.num_links = ARRAY_SIZE(snd_rpi_rpi_dac_dai),
6566
};

sound/soc/bcm/rpi-proto.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ static struct snd_soc_dai_link snd_rpi_proto_dai[] = {
9191
/* audio machine driver */
9292
static struct snd_soc_card snd_rpi_proto = {
9393
.name = "snd_rpi_proto",
94+
.owner = THIS_MODULE,
9495
.dai_link = snd_rpi_proto_dai,
9596
.num_links = ARRAY_SIZE(snd_rpi_proto_dai),
9697
};

0 commit comments

Comments
 (0)