Skip to content

Commit

Permalink
ALSA: x86: intel_hdmi_audio: use pm_runtime_resume_and_get()
Browse files Browse the repository at this point in the history
The current code does not check for errors and does not release the
reference on errors.

Signed-off-by: Pierre-Louis Bossart <[email protected]>
Reviewed-by: Bard Liao <[email protected]>
Reviewed-by: Kai Vehmanen <[email protected]>
Reviewed-by: Ranjani Sridharan <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
plbossart authored and tiwai committed Jun 17, 2022
1 parent e87c65a commit bb30b45
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sound/x86/intel_hdmi_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,9 @@ static int had_pcm_open(struct snd_pcm_substream *substream)
intelhaddata = snd_pcm_substream_chip(substream);
runtime = substream->runtime;

pm_runtime_get_sync(intelhaddata->dev);
retval = pm_runtime_resume_and_get(intelhaddata->dev);
if (retval < 0)
return retval;

/* set the runtime hw parameter with local snd_pcm_hardware struct */
runtime->hw = had_pcm_hardware;
Expand Down Expand Up @@ -1536,8 +1538,12 @@ static void had_audio_wq(struct work_struct *work)
container_of(work, struct snd_intelhad, hdmi_audio_wq);
struct intel_hdmi_lpe_audio_pdata *pdata = ctx->dev->platform_data;
struct intel_hdmi_lpe_audio_port_pdata *ppdata = &pdata->port[ctx->port];
int ret;

ret = pm_runtime_resume_and_get(ctx->dev);
if (ret < 0)
return;

pm_runtime_get_sync(ctx->dev);
mutex_lock(&ctx->mutex);
if (ppdata->pipe < 0) {
dev_dbg(ctx->dev, "%s: Event: HAD_NOTIFY_HOT_UNPLUG : port = %d\n",
Expand Down

0 comments on commit bb30b45

Please sign in to comment.