diff mbox series

ALSA: intel_hdmi: Check for error num after setting mask

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

Commit Message

Jiasheng Jiang Jan. 6, 2022, 1:24 a.m. UTC
As the dma_supported() may fail, the dma_set_mask_and_coherent() may
fail too.
Therefore, it should be better to check it and return error if fails.

Fixes: da8648097497 ("ALSA: x86: Flatten two abstraction layers")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 sound/x86/intel_hdmi_audio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Takashi Iwai Jan. 6, 2022, 8:18 a.m. UTC | #1
On Thu, 06 Jan 2022 02:24:28 +0100,
Jiasheng Jiang wrote:
> 
> As the dma_supported() may fail, the dma_set_mask_and_coherent() may
> fail too.
> Therefore, it should be better to check it and return error if fails.
> 
> Fixes: da8648097497 ("ALSA: x86: Flatten two abstraction layers")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>

Well, 32bit DMA mask practically never fails on x86 (and other
architectures, IIRC).  It's fine to add a sanity check, but it's
better to be mentioned that it never fails.


thanks,

Takashi

> ---
>  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;
>  
>  	init_channel_allocations();
>  
> -- 
> 2.25.1
>
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();