Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Pierre-Louis Bossart and committed by
Takashi Iwai
bb30b453 e87c65ae

+8 -2
+8 -2
sound/x86/intel_hdmi_audio.c
··· 1068 1068 intelhaddata = snd_pcm_substream_chip(substream); 1069 1069 runtime = substream->runtime; 1070 1070 1071 - pm_runtime_get_sync(intelhaddata->dev); 1071 + retval = pm_runtime_resume_and_get(intelhaddata->dev); 1072 + if (retval < 0) 1073 + return retval; 1072 1074 1073 1075 /* set the runtime hw parameter with local snd_pcm_hardware struct */ 1074 1076 runtime->hw = had_pcm_hardware; ··· 1538 1536 container_of(work, struct snd_intelhad, hdmi_audio_wq); 1539 1537 struct intel_hdmi_lpe_audio_pdata *pdata = ctx->dev->platform_data; 1540 1538 struct intel_hdmi_lpe_audio_port_pdata *ppdata = &pdata->port[ctx->port]; 1539 + int ret; 1541 1540 1542 - pm_runtime_get_sync(ctx->dev); 1541 + ret = pm_runtime_resume_and_get(ctx->dev); 1542 + if (ret < 0) 1543 + return; 1544 + 1543 1545 mutex_lock(&ctx->mutex); 1544 1546 if (ppdata->pipe < 0) { 1545 1547 dev_dbg(ctx->dev, "%s: Event: HAD_NOTIFY_HOT_UNPLUG : port = %d\n",