From: Takashi Iwai <tiwai@suse.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>,
alsa-devel@alsa-project.org,
Ian Minett <ian_minett@creativelabs.com>,
kernel-janitors@vger.kernel.org
Subject: Re: [patch] ALSA: hda ca0132 - remove unused error handling code
Date: Tue, 07 Feb 2012 09:59:48 +0000 [thread overview]
Message-ID: <s5hobtbotez.wl%tiwai@suse.de> (raw)
In-Reply-To: <20120207071932.GA21047@elgon.mountain>
At Tue, 7 Feb 2012 10:19:32 +0300,
Dan Carpenter wrote:
>
> We never save the return value from chipio_write() so "err" is always
> zero here, not less than zero.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> The other option would be to save the return value.
Yes, this should be a better option. chipio_write() may fail indeed.
But then your report spotted another bug. It doesn't handle
snd_hda_power_up|down() correctly in the error path. It must be fixed
as well.
I'll fix these all up.
> I don't have the
> hardware and I worried that there was a reason we don't save it. The
> current code is misleading because it looks like it's checked until
> you notice that the "err = " bit is missing.
thanks,
Takashi
>
> diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
> index 35abe3c..92f1f0c 100644
> --- a/sound/pci/hda/patch_ca0132.c
> +++ b/sound/pci/hda/patch_ca0132.c
> @@ -733,8 +733,6 @@ static int ca0132_hp_switch_put(struct snd_kcontrol *kcontrol,
> /* *valp 0 is mute, 1 is unmute */
> data = (data & 0x7f) | (*valp ? 0 : 0x80);
> chipio_write(codec, REG_CODEC_MUTE, data);
> - if (err < 0)
> - return err;
>
> spec->curr_hp_switch = *valp;
>
> @@ -775,8 +773,6 @@ static int ca0132_speaker_switch_put(struct snd_kcontrol *kcontrol,
> /* *valp 0 is mute, 1 is unmute */
> data = (data & 0xef) | (*valp ? 0 : 0x10);
> chipio_write(codec, REG_CODEC_MUTE, data);
> - if (err < 0)
> - return err;
>
> spec->curr_speaker_switch = *valp;
>
> @@ -824,14 +820,10 @@ static int ca0132_hp_volume_put(struct snd_kcontrol *kcontrol,
> val = 31 - left_vol;
> data = (data & 0xe0) | val;
> chipio_write(codec, REG_CODEC_HP_VOL_L, data);
> - if (err < 0)
> - return err;
>
> val = 31 - right_vol;
> data = (data & 0xe0) | val;
> chipio_write(codec, REG_CODEC_HP_VOL_R, data);
> - if (err < 0)
> - return err;
>
> spec->curr_hp_volume[0] = left_vol;
> spec->curr_hp_volume[1] = right_vol;
>
next prev parent reply other threads:[~2012-02-07 9:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-07 7:19 [patch] ALSA: hda ca0132 - remove unused error handling code Dan Carpenter
2012-02-07 9:59 ` Takashi Iwai [this message]
2012-02-07 10:15 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hobtbotez.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=dan.carpenter@oracle.com \
--cc=ian_minett@creativelabs.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=paul.gortmaker@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox