Skip to content

Commit bb30b45

Browse files
plbossarttiwai
authored andcommitted
ALSA: x86: intel_hdmi_audio: use pm_runtime_resume_and_get()
The current code does not check for errors and does not release the reference on errors. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20220616222910.136854-3-pierre-louis.bossart@linux.intel.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent e87c65a commit bb30b45

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

sound/x86/intel_hdmi_audio.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,9 @@ static int had_pcm_open(struct snd_pcm_substream *substream)
10681068
intelhaddata = snd_pcm_substream_chip(substream);
10691069
runtime = substream->runtime;
10701070

1071-
pm_runtime_get_sync(intelhaddata->dev);
1071+
retval = pm_runtime_resume_and_get(intelhaddata->dev);
1072+
if (retval < 0)
1073+
return retval;
10721074

10731075
/* set the runtime hw parameter with local snd_pcm_hardware struct */
10741076
runtime->hw = had_pcm_hardware;
@@ -1536,8 +1538,12 @@ static void had_audio_wq(struct work_struct *work)
15361538
container_of(work, struct snd_intelhad, hdmi_audio_wq);
15371539
struct intel_hdmi_lpe_audio_pdata *pdata = ctx->dev->platform_data;
15381540
struct intel_hdmi_lpe_audio_port_pdata *ppdata = &pdata->port[ctx->port];
1541+
int ret;
1542+
1543+
ret = pm_runtime_resume_and_get(ctx->dev);
1544+
if (ret < 0)
1545+
return;
15391546

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

0 commit comments

Comments
 (0)