lkml.org 
[lkml]   [2019]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] ASoC: stm32: sai: add missing put_device()
Date
Hi Wen,

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.

Regards
Olivier


\
 
 \ /
  Last update: 2019-02-11 16:39    [W:0.028 / U:26.744 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site