summaryrefslogtreecommitdiff
path: root/sound/hda/hdac_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/hda/hdac_sysfs.c')
-rw-r--r--sound/hda/hdac_sysfs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sound/hda/hdac_sysfs.c b/sound/hda/hdac_sysfs.c
index 0a6ce3b84cc4..c71142dea98a 100644
--- a/sound/hda/hdac_sysfs.c
+++ b/sound/hda/hdac_sysfs.c
@@ -321,8 +321,7 @@ static void widget_tree_free(struct hdac_device *codec)
free_widget_node(*p, &widget_node_group);
kfree(tree->nodes);
}
- if (tree->root)
- kobject_put(tree->root);
+ kobject_put(tree->root);
kfree(tree);
codec->widgets = NULL;
}
@@ -391,6 +390,9 @@ int hda_widget_sysfs_init(struct hdac_device *codec)
{
int err;
+ if (codec->widgets)
+ return 0; /* already created */
+
err = widget_tree_create(codec);
if (err < 0) {
widget_tree_free(codec);