ASoC: fsl_ssi: fix kernel panic in probe function
authorMichael Trimarchi <michael@amarulasolutions.com>
Thu, 18 Sep 2014 18:38:09 +0000 (20:38 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 23 Sep 2014 01:58:48 +0000 (18:58 -0700)
commit85151461f114f2fca386bb8ae6de185461d35d87
tree27dff020ff42f7eb5f063a476a6106a033d57b25
parent7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9
ASoC: fsl_ssi: fix kernel panic in probe function

code can raise a panic when the ssi_private->pdev is null

[...]
/*
 * If codec-handle property is missing from SSI node, we assume
 * that the machine driver uses new binding which does not require
 * SSI driver to trigger machine driver's probe.
 */
if (!of_get_property(np, "codec-handle", NULL))
goto done;
[...]
ssi_private->pdev =
platform_device_register_data(&pdev->dev, name, 0, NULL, 0);
[...]
done:
if (ssi_private->dai_fmt)
_fsl_ssi_set_dai_fmt(ssi_private, ssi_private->dai_fmt);

Proposal was to not use ssi_private->pdev->dev here but adding a new parameter
of *dev pointer to this _set_dai_fmt() -- passing pdev->dev in probe() and
cpu_dai->dev in fsl_ssi_set_dai_fmt().

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reported-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/fsl_ssi.c