ASoC: fsl: Fix of-node refcount unbalance in fsl_ssi_probe_from_dt()
authorTakashi Iwai <tiwai@suse.de>
Tue, 19 Feb 2019 15:46:47 +0000 (16:46 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 20 Feb 2019 12:02:50 +0000 (12:02 +0000)
The node obtained from of_find_node_by_path() has to be unreferenced
after the use, but we forgot it for the root node.

Fixes: f0fba2ad1b6b ("ASoC: multi-component - ASoC Multi-Component Support")
Cc: Timur Tabi <timur@kernel.org>
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Xiubo Li <Xiubo.Lee@gmail.com>
Cc: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/fsl_ssi.c

index 0a648229e643052d48fc3be9c716e0da5401311c..09b2967befd9668b77a16dcb262bbf045e364a50 100644 (file)
@@ -1439,8 +1439,10 @@ static int fsl_ssi_probe_from_dt(struct fsl_ssi *ssi)
         * different name to register the device.
         */
        if (!ssi->card_name[0] && of_get_property(np, "codec-handle", NULL)) {
-               sprop = of_get_property(of_find_node_by_path("/"),
-                                       "compatible", NULL);
+               struct device_node *root = of_find_node_by_path("/");
+
+               sprop = of_get_property(root, "compatible", NULL);
+               of_node_put(root);
                /* Strip "fsl," in the compatible name if applicable */
                p = strrchr(sprop, ',');
                if (p)