Re: [PATCH 2/2] ASoC: samsung: i2s: Fix multiple "IIS multi" devices initialization
From: Sylwester Nawrocki
Date: Mon Feb 18 2019 - 06:33:51 EST
On 2/18/19 12:00, Krzysztof Kozlowski wrote:
> On Fri, 15 Feb 2019 at 15:48, Sylwester Nawrocki <s.nawrocki@xxxxxxxxxxx> wrote:
>> diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
>> index e36c44e2f1bb..4a6dd86459bc 100644
>> --- a/sound/soc/samsung/i2s.c
>> +++ b/sound/soc/samsung/i2s.c
>> @@ -1339,20 +1339,34 @@ static int i2s_register_clock_provider(struct samsung_i2s_priv *priv)
>> /* Create platform device for the secondary PCM */
>> static int i2s_create_secondary_device(struct samsung_i2s_priv *priv)
>> {
[...]
>> + ret = platform_device_add(pdev_sec);
>> if (ret < 0) {
>> - dev_info(&pdev->dev, "device_attach() failed\n");
>> + platform_device_put(pdev_sec);
>> return ret;
>> }
>>
>> - priv->pdev_sec = pdev;
>> + priv->pdev_sec = pdev_sec;
>> +
>> + ret = device_attach(&pdev_sec->dev);
>> + if (ret < 0) {
>> + dev_info(&pdev_sec->dev, "device_attach() failed\n");
>
> Don't you need here platform_device_unregister()?
It's in i2s_delete_secondary_device(), but it might be better
indeed to add it here and move the priv->pdev_sec assignment
to the end making it a last step.
--
Thanks,
Sylwester