diff mbox series

[v2] ALSA: intel_hdmi: Check for error num after setting mask

Message ID 20220106094402.2738082-1-jiasheng@iscas.ac.cn (mailing list archive)
State Superseded
Headers show
Series [v2] ALSA: intel_hdmi: Check for error num after setting mask | expand

Commit Message

Jiasheng Jiang Jan. 6, 2022, 9:44 a.m. UTC
To maintain the consistency of the code, it should be better to add the
sanity check after calling dma_set_mask_and_coherent(), like
tegra_pcm_dma_allocate() in `sound/soc/tegra/tegra_pcm.c`.

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
Changelog

v1 -> v2

* Change 1. Remove the fixes tag and change the message.
---
 sound/x86/intel_hdmi_audio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Takashi Iwai Jan. 6, 2022, 2:58 p.m. UTC | #1
On Thu, 06 Jan 2022 10:44:02 +0100,
Jiasheng Jiang wrote:
> 
> To maintain the consistency of the code, it should be better to add the
> sanity check after calling dma_set_mask_and_coherent(), like
> tegra_pcm_dma_allocate() in `sound/soc/tegra/tegra_pcm.c`.
> 
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
> Changelog
> 
> v1 -> v2
> 
> * Change 1. Remove the fixes tag and change the message.
> ---
>  sound/x86/intel_hdmi_audio.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c
> index 33b12aa67cf5..6caea517f07f 100644
> --- a/sound/x86/intel_hdmi_audio.c
> +++ b/sound/x86/intel_hdmi_audio.c
> @@ -1770,7 +1770,9 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev)
>  	card_ctx->irq = irq;
>  
>  	/* only 32bit addressable */
> -	dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> +	ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> +	if (ret)
> +		goto err;

The build fails with the latest code, unfortunately.
This function simply returns an error, as it was changed to a devres
allocation some time ago.


thanks,

Takashi
diff mbox series

Patch

diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c
index 33b12aa67cf5..6caea517f07f 100644
--- a/sound/x86/intel_hdmi_audio.c
+++ b/sound/x86/intel_hdmi_audio.c
@@ -1770,7 +1770,9 @@  static int hdmi_lpe_audio_probe(struct platform_device *pdev)
 	card_ctx->irq = irq;
 
 	/* only 32bit addressable */
-	dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+	ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+	if (ret)
+		goto err;
 
 	init_channel_allocations();