From: Nicolin Chen <nicoleotsuka@gmail.com>
To: Michael Trimarchi <michael@amarulasolutions.com>
Cc: broonie@kernel.org, Li.Xiubo@freescale.com, timur@tabi.org,
alsa-devel@alsa-project.org
Subject: Re: [PATCH] ASoC: fsl_ssi: fix kernel panic in probe function
Date: Thu, 18 Sep 2014 15:40:55 -0700 [thread overview]
Message-ID: <20140918224055.GA29065@Alpha> (raw)
In-Reply-To: <1411065489-21496-1-git-send-email-michael@amarulasolutions.com>
On Thu, Sep 18, 2014 at 08:38:09PM +0200, Michael Trimarchi wrote:
> 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>
> Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Thank you
> ---
> sound/soc/fsl/fsl_ssi.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
> index 87eb577..de6ab06 100644
> --- a/sound/soc/fsl/fsl_ssi.c
> +++ b/sound/soc/fsl/fsl_ssi.c
> @@ -748,8 +748,9 @@ static int fsl_ssi_hw_free(struct snd_pcm_substream *substream,
> return 0;
> }
>
> -static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private,
> - unsigned int fmt)
> +static int _fsl_ssi_set_dai_fmt(struct device *dev,
> + struct fsl_ssi_private *ssi_private,
> + unsigned int fmt)
> {
> struct regmap *regs = ssi_private->regs;
> u32 strcr = 0, stcr, srcr, scr, mask;
> @@ -758,7 +759,7 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private,
> ssi_private->dai_fmt = fmt;
>
> if (fsl_ssi_is_i2s_master(ssi_private) && IS_ERR(ssi_private->baudclk)) {
> - dev_err(&ssi_private->pdev->dev, "baudclk is missing which is necessary for master mode\n");
> + dev_err(dev, "baudclk is missing which is necessary for master mode\n");
> return -EINVAL;
> }
>
> @@ -913,7 +914,7 @@ static int fsl_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
> {
> struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai);
>
> - return _fsl_ssi_set_dai_fmt(ssi_private, fmt);
> + return _fsl_ssi_set_dai_fmt(cpu_dai->dev, ssi_private, fmt);
> }
>
> /**
> @@ -1387,7 +1388,8 @@ static int fsl_ssi_probe(struct platform_device *pdev)
>
> done:
> if (ssi_private->dai_fmt)
> - _fsl_ssi_set_dai_fmt(ssi_private, ssi_private->dai_fmt);
> + _fsl_ssi_set_dai_fmt(&pdev->dev, ssi_private,
> + ssi_private->dai_fmt);
>
> return 0;
>
> --
> 1.8.1.2
>
next prev parent reply other threads:[~2014-09-18 22:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-18 18:38 [PATCH] ASoC: fsl_ssi: fix kernel panic in probe function Michael Trimarchi
2014-09-18 22:40 ` Nicolin Chen [this message]
2014-09-23 1:58 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140918224055.GA29065@Alpha \
--to=nicoleotsuka@gmail.com \
--cc=Li.Xiubo@freescale.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=michael@amarulasolutions.com \
--cc=timur@tabi.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.