From patchwork Sun Dec 27 00:52:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henrique de Moraes Holschuh X-Patchwork-Id: 69809 X-Patchwork-Delegate: lenb@kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id nBR0qPPB015917 for ; Sun, 27 Dec 2009 00:52:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752241AbZL0AwY (ORCPT ); Sat, 26 Dec 2009 19:52:24 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752256AbZL0AwX (ORCPT ); Sat, 26 Dec 2009 19:52:23 -0500 Received: from out1.smtp.messagingengine.com ([66.111.4.25]:53068 "EHLO out1.smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751653AbZL0AwW (ORCPT ); Sat, 26 Dec 2009 19:52:22 -0500 Received: from compute1.internal (compute1.internal [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id 39A4FC917D; Sat, 26 Dec 2009 19:52:22 -0500 (EST) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute1.internal (MEProxy); Sat, 26 Dec 2009 19:52:22 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=from:to:cc:subject:date:message-id:in-reply-to:references; s=smtpout; bh=vZlNirVtgeOpTcuIP8/EngDB2kQ=; b=nDRX1/F72XRuayAoDNdBHC9rYSpExXJ+dbMq34kMknWTThNsXhCRHEIKXmwKjmXSobKe8O9U17rN0iZQ7aIFvXTx27Xtq1Y5q3FkEOuU21ya9PYP/Zc3cimxkRTOJ0X0+i72Oh7LvGrNZN3Wm8wYGgSiD7coJp6i0C6U51xC68M= X-Sasl-enc: 1TDefwCNfctGhbzsJ1HQ5rGtQGwrxeHSBXnIBejUBqhF 1261875141 Received: from khazad-dum.debian.net (unknown [201.82.165.62]) by mail.messagingengine.com (Postfix) with ESMTPSA id CDA84A5AE5; Sat, 26 Dec 2009 19:52:21 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by localhost.khazad-dum.debian.net (Postfix) with ESMTP id 27ADA281F9; Sat, 26 Dec 2009 22:52:20 -0200 (BRST) X-Virus-Scanned: Debian amavisd-new at khazad-dum.debian.net Received: from khazad-dum.debian.net ([127.0.0.1]) by localhost (khazad-dum.debian.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id UcpTZYy5jvJ8; Sat, 26 Dec 2009 22:52:19 -0200 (BRST) Received: by khazad-dum.debian.net (Postfix, from userid 1000) id 43D632823A; Sat, 26 Dec 2009 22:52:19 -0200 (BRST) From: Henrique de Moraes Holschuh To: Len Brown Cc: linux-acpi@vger.kernel.org, ibm-acpi-devel@lists.sourceforge.net, Henrique de Moraes Holschuh Subject: [PATCH 2/5] thinkpad-acpi: don't fail to load the entire module due to ALSA problems Date: Sat, 26 Dec 2009 22:52:14 -0200 Message-Id: <1261875137-27565-3-git-send-email-hmh@hmh.eng.br> X-Mailer: git-send-email 1.6.5.2 In-Reply-To: <1261875137-27565-1-git-send-email-hmh@hmh.eng.br> References: <1261875137-27565-1-git-send-email-hmh@hmh.eng.br> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 3311b00..9b7da9c 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -6705,10 +6705,11 @@ static int __init volume_create_alsa_mixer(void) rc = snd_card_create(alsa_index, alsa_id, THIS_MODULE, sizeof(struct tpacpi_alsa_data), &card); - if (rc < 0) - return rc; - if (!card) - return -ENOMEM; + if (rc < 0 || !card) { + printk(TPACPI_ERR + "Failed to create ALSA card structures: %d\n", rc); + return 1; + } BUG_ON(!card->private_data); data = card->private_data; @@ -6741,8 +6742,9 @@ static int __init volume_create_alsa_mixer(void) rc = snd_ctl_add(card, ctl_vol); if (rc < 0) { printk(TPACPI_ERR - "Failed to create ALSA volume control\n"); - goto err_out; + "Failed to create ALSA volume control: %d\n", + rc); + goto err_exit; } data->ctl_vol_id = &ctl_vol->id; } @@ -6750,22 +6752,25 @@ static int __init volume_create_alsa_mixer(void) ctl_mute = snd_ctl_new1(&volume_alsa_control_mute, NULL); rc = snd_ctl_add(card, ctl_mute); if (rc < 0) { - printk(TPACPI_ERR "Failed to create ALSA mute control\n"); - goto err_out; + printk(TPACPI_ERR "Failed to create ALSA mute control: %d\n", + rc); + goto err_exit; } data->ctl_mute_id = &ctl_mute->id; snd_card_set_dev(card, &tpacpi_pdev->dev); rc = snd_card_register(card); - -err_out: if (rc < 0) { - snd_card_free(card); - card = NULL; + printk(TPACPI_ERR "Failed to register ALSA card: %d\n", rc); + goto err_exit; } alsa_card = card; - return rc; + return 0; + +err_exit: + snd_card_free(card); + return 1; } #define TPACPI_VOL_Q_MUTEONLY 0x0001 /* Mute-only control available */