From: Takashi Iwai Subject: Re: [PATCH v2] ASoC: hda: fix unbalanced codec dev refcount for HDA_DEV_ASOC Date: Fri, 31 May 2019 19:06:02 +0200 Message-ID: References: <20190531160137.5603-1-ranjani.sridharan@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 4A1B0F80757 for ; Fri, 31 May 2019 19:06:03 +0200 (CEST) In-Reply-To: <20190531160137.5603-1-ranjani.sridharan@linux.intel.com> 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@linux.intel.com List-Id: alsa-devel@alsa-project.org On Fri, 31 May 2019 18:01:37 +0200, Ranjani Sridharan wrote: > > HDA_DEV_ASOC type codec device refcounts are managed differently > from HDA_DEV_LEGACY devices. The refcount is released explicitly > in snd_hdac_ext_bus_device_remove() for ASOC type devices. > So, remove the put_device() call in snd_hda_codec_dev_free() > for such devices to make the refcount balanced. This will prevent > the NULL pointer exception when the codec driver is released > after the card is freed. > > Signed-off-by: Ranjani Sridharan Reviewed-by: Takashi Iwai FWIW, snd_hdac_ext_bus_device_remove() is called at the machine driver remove callback that is called from soc_remove_dai_linkes() in soc_cleanup_card_resources(). There, the order is assured that snd_card_free() gets called at first, so this change should be correct -- the HD-audio codec object gets freed at a later point for ASoC. thanks, Takashi