Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B7C5C433F5 for ; Thu, 6 Jan 2022 08:18:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236506AbiAFISD (ORCPT ); Thu, 6 Jan 2022 03:18:03 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:40022 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236013AbiAFISC (ORCPT ); Thu, 6 Jan 2022 03:18:02 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id BB4B9210E0; Thu, 6 Jan 2022 08:18:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1641457081; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=urSvGdydF+jD4IDgGKHj3ETah6j1cUHdotWqXNMWEkk=; b=y84mLYTgPgjSNWxI0EjVMrkm/rMG/p7SEUo6x1wO2mg+lmvzM93NgVVl+TBnNespFA9thr cn6QiK2WDUuKBHM1/e6Cj1Zo/4wLpViaOH6UmLDNSE8vlOaipOT5BLHjyRrN8vV9pmJcfr ITSb/d0bVGdXhfemenDWwevP4ity3y4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1641457081; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=urSvGdydF+jD4IDgGKHj3ETah6j1cUHdotWqXNMWEkk=; b=RDk8Z31nt34GNSLOqfc51aCIGxZRKxkI6+k1C3gsDvEnOfEBUWUGWWATl4G+oCd7rtpoi6 64wwkVpaSnxx3sBQ== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 82552A3B81; Thu, 6 Jan 2022 08:18:01 +0000 (UTC) Date: Thu, 06 Jan 2022 09:18:01 +0100 Message-ID: From: Takashi Iwai To: Jiasheng Jiang Cc: perex@perex.cz, tiwai@suse.com, leon@kernel.org, broonie@kernel.org, joe@perches.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ALSA: intel_hdmi: Check for error num after setting mask In-Reply-To: <20220106012428.2504003-1-jiasheng@iscas.ac.cn> References: <20220106012428.2504003-1-jiasheng@iscas.ac.cn> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 >