diff options
-rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 3311b0020569..9b7da9c96e76 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) | |||
6705 | 6705 | ||
6706 | rc = snd_card_create(alsa_index, alsa_id, THIS_MODULE, | 6706 | rc = snd_card_create(alsa_index, alsa_id, THIS_MODULE, |
6707 | sizeof(struct tpacpi_alsa_data), &card); | 6707 | sizeof(struct tpacpi_alsa_data), &card); |
6708 | if (rc < 0) | 6708 | if (rc < 0 || !card) { |
6709 | return rc; | 6709 | printk(TPACPI_ERR |
6710 | if (!card) | 6710 | "Failed to create ALSA card structures: %d\n", rc); |
6711 | return -ENOMEM; | 6711 | return 1; |
6712 | } | ||
6712 | 6713 | ||
6713 | BUG_ON(!card->private_data); | 6714 | BUG_ON(!card->private_data); |
6714 | data = card->private_data; | 6715 | data = card->private_data; |
@@ -6741,8 +6742,9 @@ static int __init volume_create_alsa_mixer(void) | |||
6741 | rc = snd_ctl_add(card, ctl_vol); | 6742 | rc = snd_ctl_add(card, ctl_vol); |
6742 | if (rc < 0) { | 6743 | if (rc < 0) { |
6743 | printk(TPACPI_ERR | 6744 | printk(TPACPI_ERR |
6744 | "Failed to create ALSA volume control\n"); | 6745 | "Failed to create ALSA volume control: %d\n", |
6745 | goto err_out; | 6746 | rc); |
6747 | goto err_exit; | ||
6746 | } | 6748 | } |
6747 | data->ctl_vol_id = &ctl_vol->id; | 6749 | data->ctl_vol_id = &ctl_vol->id; |
6748 | } | 6750 | } |
@@ -6750,22 +6752,25 @@ static int __init volume_create_alsa_mixer(void) | |||
6750 | ctl_mute = snd_ctl_new1(&volume_alsa_control_mute, NULL); | 6752 | ctl_mute = snd_ctl_new1(&volume_alsa_control_mute, NULL); |
6751 | rc = snd_ctl_add(card, ctl_mute); | 6753 | rc = snd_ctl_add(card, ctl_mute); |
6752 | if (rc < 0) { | 6754 | if (rc < 0) { |
6753 | printk(TPACPI_ERR "Failed to create ALSA mute control\n"); | 6755 | printk(TPACPI_ERR "Failed to create ALSA mute control: %d\n", |
6754 | goto err_out; | 6756 | rc); |
6757 | goto err_exit; | ||
6755 | } | 6758 | } |
6756 | data->ctl_mute_id = &ctl_mute->id; | 6759 | data->ctl_mute_id = &ctl_mute->id; |
6757 | 6760 | ||
6758 | snd_card_set_dev(card, &tpacpi_pdev->dev); | 6761 | snd_card_set_dev(card, &tpacpi_pdev->dev); |
6759 | rc = snd_card_register(card); | 6762 | rc = snd_card_register(card); |
6760 | |||
6761 | err_out: | ||
6762 | if (rc < 0) { | 6763 | if (rc < 0) { |
6763 | snd_card_free(card); | 6764 | printk(TPACPI_ERR "Failed to register ALSA card: %d\n", rc); |
6764 | card = NULL; | 6765 | goto err_exit; |
6765 | } | 6766 | } |
6766 | 6767 | ||
6767 | alsa_card = card; | 6768 | alsa_card = card; |
6768 | return rc; | 6769 | return 0; |
6770 | |||
6771 | err_exit: | ||
6772 | snd_card_free(card); | ||
6773 | return 1; | ||
6769 | } | 6774 | } |
6770 | 6775 | ||
6771 | #define TPACPI_VOL_Q_MUTEONLY 0x0001 /* Mute-only control available */ | 6776 | #define TPACPI_VOL_Q_MUTEONLY 0x0001 /* Mute-only control available */ |