All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: alsa-devel@alsa-project.org, Chris Wilson <chris@chris-wilson.co.uk>
Subject: Re: [PATCH 1/3] ALSA: hda - Handle error from snd_hda_power_up*()
Date: Wed, 27 Jun 2018 23:49:21 +0200	[thread overview]
Message-ID: <s5h36x77vdq.wl-tiwai@suse.de> (raw)
In-Reply-To: <20180627161206.GG20518@intel.com>

On Wed, 27 Jun 2018 18:12:06 +0200,
Ville Syrjälä wrote:
> 
> On Wed, Jun 27, 2018 at 11:10:32AM +0200, Takashi Iwai wrote:
> > Although snd_hda_power_up() and snd_hda_power_up_pm() may fail, we
> > haven't dealt with the error properly in many places.  It's an unusual
> > situation but still possible.
> > 
> > This patch spots these places and adds the proper error paths.
> > 
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > ---
> >  sound/pci/hda/hda_beep.c       |  3 +-
> >  sound/pci/hda/hda_codec.c      |  4 ++-
> >  sound/pci/hda/hda_controller.c |  4 ++-
> >  sound/pci/hda/hda_proc.c       |  3 +-
> >  sound/pci/hda/hda_sysfs.c      |  4 ++-
> >  sound/pci/hda/patch_ca0132.c   | 53 +++++++++++++++++++++++++++-------
> >  sound/pci/hda/patch_realtek.c  |  3 +-
> >  7 files changed, 57 insertions(+), 17 deletions(-)
> > 
> > diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
> > index 066b5b59c4d7..e9d5fbd6c13a 100644
> > --- a/sound/pci/hda/hda_beep.c
> > +++ b/sound/pci/hda/hda_beep.c
> > @@ -26,7 +26,8 @@ static void generate_tone(struct hda_beep *beep, int tone)
> >  	struct hda_codec *codec = beep->codec;
> >  
> >  	if (tone && !beep->playing) {
> > -		snd_hda_power_up(codec);
> > +		if (snd_hda_power_up(codec) < 0)
> > +			return;
> >  		if (beep->power_hook)
> >  			beep->power_hook(beep, true);
> >  		beep->playing = 1;
> > diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
> > index 20a171ac4bb2..44165f3e344e 100644
> > --- a/sound/pci/hda/hda_codec.c
> > +++ b/sound/pci/hda/hda_codec.c
> > @@ -65,7 +65,9 @@ static int codec_exec_verb(struct hdac_device *dev, unsigned int cmd,
> >  		return -1;
> >  
> >   again:
> > -	snd_hda_power_up_pm(codec);
> > +	err = snd_hda_power_up_pm(codec);
> > +	if (err < 0)
> > +		return err;
> >  	mutex_lock(&bus->core.cmd_mutex);
> >  	if (flags & HDA_RW_NO_RESPONSE_FALLBACK)
> >  		bus->no_response_fallback = 1;
> > diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
> > index a12e594d4e3b..4273be1f3eaa 100644
> > --- a/sound/pci/hda/hda_controller.c
> > +++ b/sound/pci/hda/hda_controller.c
> > @@ -645,7 +645,9 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
> >  				   buff_step);
> >  	snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
> >  				   buff_step);
> > -	snd_hda_power_up(apcm->codec);
> > +	err = snd_hda_power_up(apcm->codec);
> > +	if (err < 0)
> > +		return err;
> 
> Missing azx_release_device() here?

Yes, and even worse, it skips the mutex unlock :-<
Let's scratch this patch.


thanks,

Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2018-06-27 21:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-27  9:10 [PATCH 0/3] ALSA: PM-related fixes/cleanups Takashi Iwai
2018-06-27  9:10 ` [PATCH 1/3] ALSA: hda - Handle error from snd_hda_power_up*() Takashi Iwai
2018-06-27  9:36   ` Chris Wilson
2018-06-27  9:50     ` Takashi Iwai
2018-06-27 15:54   ` Chris Wilson
2018-06-27 16:09     ` Takashi Iwai
2018-06-27 21:48       ` Takashi Iwai
2018-06-27 16:12   ` Ville Syrjälä
2018-06-27 21:49     ` Takashi Iwai [this message]
2018-06-28  9:02   ` [alsa-devel] " Dan Carpenter
2018-06-27  9:10 ` [PATCH 2/3] ALSA: hda - Move in_pm accessors to HDA core Takashi Iwai
2018-06-27  9:38   ` Chris Wilson
2018-06-27 22:05     ` Takashi Iwai
2018-06-27  9:10 ` [PATCH 3/3] ALSA: hda/hdmi - Don't fall back to generic when i915 binding fails Takashi Iwai
2018-06-27 13:57 ` [PATCH 0/3] ALSA: PM-related fixes/cleanups Chris Wilson

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=s5h36x77vdq.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=ville.syrjala@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.