From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH] ASoC: hda: increment codec device refcount when it is added to the card Date: Fri, 31 May 2019 17:45:53 +0200 Message-ID: References: <20190530201828.2648-1-ranjani.sridharan@linux.intel.com> <684fe069-d2fb-f716-bd3e-67f0c7a52de0@linux.intel.com> <0f75caffee97f7cec5a1bd31e9f3eb3ea1a12948.camel@linux.intel.com> <6e0653565e70e877974f92e94cf4ae49caee3e15.camel@linux.intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 44AA6F80757 for ; Fri, 31 May 2019 17:45:54 +0200 (CEST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" To: Ranjani Sridharan Cc: alsa-devel@alsa-project.org, broonie@kernel.org, Pierre-Louis Bossart List-Id: alsa-devel@alsa-project.org On Fri, 31 May 2019 17:43:53 +0200, Ranjani Sridharan wrote: > > > > Hi Takashi, > > > > > > No, this actually comes at the second step in the case of SOF (ie > > > after > > > the machine driver is unregistered). > > > > > > Actually, I just found out what's causing the issue. It is the call > > > to > > > snd_hda_codec_dev_free() which calls put_device() when > > > snd_card_free() > > > is invoked. So, adding a get_device() in snd_hda_codec_device_new() > > > would make the refcount balanced. > > > > > > On the other hand, removing the put_device() in > > > snd_hda_codec_dev_free() would also address the problem. I'm not > > > sure > > > which would be the preferred route. > > > > The latter one, I'd say. > > > > Actually the difference between ASoC and the legacy HDA bus is who > > releases the device object. For HDA legacy bus, it's supposed to be > > done via snd_device_free() chain, while ASoC bus releases explicitly > > as shown in my previous post. > > > > So, if any, I'd paper over it like below. > OK, makes sense. Let me send a V2 with the change. > > Also, should I also look into adding the change to make hdac_hdmi codec > card managed as well? Well, feel free to fix more bugs, of course ;) BTW, I'll be on vacation from tomorrow for a week, so my reply will be delayed. thanks, Takashi