Skip to content

Commit 5c74c9d

Browse files
charleskeepaxbroonie
authored andcommitted
ASoC: soc-core: Fix regression causing sysfs entries to disappear
The allocation order of things in soc_new_pcm_runtime was changed to move the device_register before the allocation of the rtd structure. This was to allow the rtd allocation to be managed by devm. However currently the sysfs entries are added by device_register and their visibility depends on variables within the rtd structure, this causes the pmdown_time and dapm_widgets sysfs entries to be missing for all rtds. Correct this issue by manually calling device_add_groups after the appropriate information is available. Fixes: d918a37 ("ASoC: soc-core: tidyup soc_new_pcm_runtime() alloc order") Signed-off-by: Charles Keepax <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent dc5fb6d commit 5c74c9d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sound/soc/soc-core.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
446446

447447
dev->parent = card->dev;
448448
dev->release = soc_release_rtd_dev;
449-
dev->groups = soc_dev_attr_groups;
450449

451450
dev_set_name(dev, "%s", dai_link->name);
452451

@@ -503,6 +502,10 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
503502
/* see for_each_card_rtds */
504503
list_add_tail(&rtd->list, &card->rtd_list);
505504

505+
ret = device_add_groups(dev, soc_dev_attr_groups);
506+
if (ret < 0)
507+
goto free_rtd;
508+
506509
return rtd;
507510

508511
free_rtd:

0 commit comments

Comments
 (0)