From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753011AbaGKKGm (ORCPT ); Fri, 11 Jul 2014 06:06:42 -0400 Received: from cantor2.suse.de ([195.135.220.15]:52430 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752469AbaGKKGl (ORCPT ); Fri, 11 Jul 2014 06:06:41 -0400 Date: Fri, 11 Jul 2014 12:06:39 +0200 Message-ID: From: Takashi Iwai To: Konstantinos Tsimpoukas Cc: , Jaroslav Kysela , , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] ice1712: check if snd card loaded, if not do not proceed In-Reply-To: <1405052377-3096-1-git-send-email-kostaslinuxxx@gmail.com> References: <1405052377-3096-1-git-send-email-kostaslinuxxx@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Thu, 10 Jul 2014 23:19:37 -0500, Konstantinos Tsimpoukas wrote: > > Just adding a simple if statement, which > verifies if actually card is loaded, if not > does not continue with the execution > of the snd_card_free. It's already referenced by ice, so a NULL check must be peformed at first. But, basically card is always non-NULL. The remove callback is called only for objects that was properly bound with probe callback. snd_ice1712_probe() always sets the card pointer when it succeeds. thanks, Takashi > Signed-off-by: Konstantinos Tsimpoukas > --- > sound/pci/ice1712/ice1712.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c > index d9b9e45..431096b 100644 > --- a/sound/pci/ice1712/ice1712.c > +++ b/sound/pci/ice1712/ice1712.c > @@ -2819,7 +2819,8 @@ static void snd_ice1712_remove(struct pci_dev *pci) > > if (ice->card_info && ice->card_info->chip_exit) > ice->card_info->chip_exit(ice); > - snd_card_free(card); > + if (card) > + snd_card_free(card); > } > > #ifdef CONFIG_PM_SLEEP > -- > 1.9.1 >