linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Wen Yang <yellowriver2010@hotmail.com>
To: Olivier MOYSAN <olivier.moysan@st.com>,
	Arnaud POULIQUEN <arnaud.pouliquen@st.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	"Alexandre TORGUE" <alexandre.torgue@st.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"linux-stm32@st-md-mailman.stormreply.com"
	<linux-stm32@st-md-mailman.stormreply.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ASoC: stm32: sai: add missing put_device()
Date: Wed, 13 Feb 2019 14:41:53 +0000	[thread overview]
Message-ID: <HK0PR02MB3634F3A1A0C8BF4EEC5C3874B2660@HK0PR02MB3634.apcprd02.prod.outlook.com> (raw)
In-Reply-To: <18decbe3-5a7c-1b75-4c64-0b16fdd0efec@st.com>

From: Olivier MOYSAN <olivier.moysan@st.com>
Sent: 11 February 2019 15:09
To: Wen Yang; Arnaud POULIQUEN; Liam Girdwood; Mark Brown; Jaroslav Kysela; Takashi Iwai; Maxime Coquelin; Alexandre TORGUE
Cc: alsa-devel@alsa-project.org; linux-stm32@st-md-mailman.stormreply.com; linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: stm32: sai: add missing put_device()

>On 2/9/19 11:41 AM, Wen Yang wrote:
>> The of_find_device_by_node() takes a reference to the underlying device
>> structure, we should release that reference.
>>
>> Fixes: 7dd0d835582f ("ASoC: stm32: sai: simplify sync modes management")
>> Signed-off-by: Wen Yang <yellowriver2010@hotmail.com>
>> ---
>>   sound/soc/stm/stm32_sai.c | 11 ++++++++---
>>   1 file changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/sound/soc/stm/stm32_sai.c b/sound/soc/stm/stm32_sai.c
>> index bcb35ca..14c9591 100644
>> --- a/sound/soc/stm/stm32_sai.c
>> +++ b/sound/soc/stm/stm32_sai.c
>> @@ -112,16 +112,21 @@ static int stm32_sai_set_sync(struct stm32_sai_data *sai_client,
>
>goto error also in previous test
>       if (!pdev) {
>               ...
>               ret = -ENODEV;
>                goto error;
>        }
>
>>       if (!sai_provider) {
>>               dev_err(&sai_client->pdev->dev,
>>                       "SAI sync provider data not found\n");
>> -             return -EINVAL;
>> +             ret = -EINVAL;
>> +             goto out_put_dev;
>>       }
>>
>>       /* Configure sync client */
>>       ret = stm32_sai_sync_conf_client(sai_client, synci);
>>       if (ret < 0)
>> -             return ret;
>> +             goto out_put_dev;
>>
>>       /* Configure sync provider */
>> -     return stm32_sai_sync_conf_provider(sai_provider, synco);
>> +     ret = stm32_sai_sync_conf_provider(sai_provider, synco);
>> +
>> +out_put_dev:
>> +     put_device(&pdev->dev);
>> +     return ret;
>
>Here I propose:
>error:
>        of_node_put(np_provider);
>        return ret;
>
>>   }
>>
>>   static int stm32_sai_probe(struct platform_device *pdev)
>>

>Thanks for your patch. Please, see my comments above.

Thanks for your comments, in this patch we only fix the problem of missing put_device().
The problem of missing of_node_put() is a bit more complicated:
For the variable np_provider(np_sync_provider):
1, it is obtained by of_get_parent(), but it is not released;
2, error code not obtained when calling sai->pdata->set_sync()

We will submit another patch to fix the failure of np_sync_provider
Thank you.

Regards
Wen



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-02-13 14:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-09 10:41 [PATCH] ASoC: stm32: sai: add missing put_device() Wen Yang
2019-02-11 15:09 ` Olivier MOYSAN
2019-02-13 14:41   ` Wen Yang [this message]
2019-02-14 10:39     ` Olivier MOYSAN
2019-02-14 13:14 ` Applied "ASoC: stm32: sai: add missing put_device()" to the asoc tree 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=HK0PR02MB3634F3A1A0C8BF4EEC5C3874B2660@HK0PR02MB3634.apcprd02.prod.outlook.com \
    --to=yellowriver2010@hotmail.com \
    --cc=alexandre.torgue@st.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnaud.pouliquen@st.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=olivier.moysan@st.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).