From patchwork Wed Jul 16 14:33:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 4567591 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 48D909F37C for ; Wed, 16 Jul 2014 14:33:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 775B4201C8 for ; Wed, 16 Jul 2014 14:33:53 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 394C7201C0 for ; Wed, 16 Jul 2014 14:33:52 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 63B8A26533F; Wed, 16 Jul 2014 16:33:45 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 4797B2651D8; Wed, 16 Jul 2014 16:33:35 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 262BB26524C; Wed, 16 Jul 2014 16:33:34 +0200 (CEST) Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 3C9E02651B9 for ; Wed, 16 Jul 2014 16:33:27 +0200 (CEST) Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id EC1BEAB5D for ; Wed, 16 Jul 2014 14:33:26 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Date: Wed, 16 Jul 2014 16:33:26 +0200 Message-Id: <1405521206-12486-1-git-send-email-tiwai@suse.de> X-Mailer: git-send-email 2.0.1 Subject: [alsa-devel] [PATCH] ALSA: hda - Add NULL check to all PM ops in hda_intel.c X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Since devptr can be NULL due to asynchronous probe, all PM ops should have NULL checks at the beginning. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 8edcee5f034d..387fc73a5c89 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -772,10 +772,15 @@ static int azx_suspend(struct device *dev) { struct pci_dev *pci = to_pci_dev(dev); struct snd_card *card = dev_get_drvdata(dev); - struct azx *chip = card->private_data; - struct hda_intel *hda = container_of(chip, struct hda_intel, chip); + struct azx *chip; + struct hda_intel *hda; struct azx_pcm *p; + if (!card) + return 0; + + chip = card->private_data; + hda = container_of(chip, struct hda_intel, chip); if (chip->disabled || hda->init_failed) return 0; @@ -806,9 +811,14 @@ static int azx_resume(struct device *dev) { struct pci_dev *pci = to_pci_dev(dev); struct snd_card *card = dev_get_drvdata(dev); - struct azx *chip = card->private_data; - struct hda_intel *hda = container_of(chip, struct hda_intel, chip); + struct azx *chip; + struct hda_intel *hda; + if (!card) + return 0; + + chip = card->private_data; + hda = container_of(chip, struct hda_intel, chip); if (chip->disabled || hda->init_failed) return 0; @@ -844,9 +854,14 @@ static int azx_resume(struct device *dev) static int azx_runtime_suspend(struct device *dev) { struct snd_card *card = dev_get_drvdata(dev); - struct azx *chip = card->private_data; - struct hda_intel *hda = container_of(chip, struct hda_intel, chip); + struct azx *chip; + struct hda_intel *hda; + if (!card) + return 0; + + chip = card->private_data; + hda = container_of(chip, struct hda_intel, chip); if (chip->disabled || hda->init_failed) return 0; @@ -869,12 +884,17 @@ static int azx_runtime_suspend(struct device *dev) static int azx_runtime_resume(struct device *dev) { struct snd_card *card = dev_get_drvdata(dev); - struct azx *chip = card->private_data; - struct hda_intel *hda = container_of(chip, struct hda_intel, chip); + struct azx *chip; + struct hda_intel *hda; struct hda_bus *bus; struct hda_codec *codec; int status; + if (!card) + return 0; + + chip = card->private_data; + hda = container_of(chip, struct hda_intel, chip); if (chip->disabled || hda->init_failed) return 0; @@ -910,9 +930,14 @@ static int azx_runtime_resume(struct device *dev) static int azx_runtime_idle(struct device *dev) { struct snd_card *card = dev_get_drvdata(dev); - struct azx *chip = card->private_data; - struct hda_intel *hda = container_of(chip, struct hda_intel, chip); + struct azx *chip; + struct hda_intel *hda; + + if (!card) + return 0; + chip = card->private_data; + hda = container_of(chip, struct hda_intel, chip); if (chip->disabled || hda->init_failed) return 0;