From mboxrd@z Thu Jan 1 00:00:00 1970 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 62205C64EC4 for ; Fri, 10 Mar 2023 14:01:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231513AbjCJOBF (ORCPT ); Fri, 10 Mar 2023 09:01:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231536AbjCJOBC (ORCPT ); Fri, 10 Mar 2023 09:01:02 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C83F2114EF5 for ; Fri, 10 Mar 2023 06:00:53 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7A2EDB822BA for ; Fri, 10 Mar 2023 14:00:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD58AC433EF; Fri, 10 Mar 2023 14:00:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678456851; bh=dX4rEmIFO27bO7AQOKWNI2F8gHXYOMoxqFMOzaz+fNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xn5fqJs1KWhG38YQs3GS0Pf19suZupl8HaPs8bYLsbeMoP1Zb0VpsVgMi48HJ8sIE cPC0F9bWmA2jvaIJAEaZlBpH9KyXfd66aqb47P4X5inkV0ifDEQVHeeQEE/dCLHlex /4/URLv68royOKOrZjCDSjdbk++oJxhmWYoGNhFQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Martin=20Povi=C5=A1er?= , Mark Brown , Sasha Levin Subject: [PATCH 6.2 116/211] ASoC: apple: mca: Improve handling of unavailable DMA channels Date: Fri, 10 Mar 2023 14:38:16 +0100 Message-Id: <20230310133722.269651232@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310133718.689332661@linuxfoundation.org> References: <20230310133718.689332661@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Martin Povišer [ Upstream commit fb1847cc460c127b12720119eae5f438ffc62e85 ] When we fail to obtain a DMA channel, don't return a blanket -EINVAL, instead return the original error code if there's one. This makes deferring work as it should. Also don't print an error message for -EPROBE_DEFER. Fixes: 4ec8179c212f ("ASoC: apple: mca: Postpone requesting of DMA channels") Signed-off-by: Martin Povišer Link: https://lore.kernel.org/r/20230224153302.45365-3-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/apple/mca.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sound/soc/apple/mca.c b/sound/soc/apple/mca.c index aea08c7b2ee85..64750db9b9639 100644 --- a/sound/soc/apple/mca.c +++ b/sound/soc/apple/mca.c @@ -950,10 +950,17 @@ static int mca_pcm_new(struct snd_soc_component *component, chan = mca_request_dma_channel(cl, i); if (IS_ERR_OR_NULL(chan)) { + mca_pcm_free(component, rtd->pcm); + + if (chan && PTR_ERR(chan) == -EPROBE_DEFER) + return PTR_ERR(chan); + dev_err(component->dev, "unable to obtain DMA channel (stream %d cluster %d): %pe\n", i, cl->no, chan); - mca_pcm_free(component, rtd->pcm); - return -EINVAL; + + if (!chan) + return -EINVAL; + return PTR_ERR(chan); } cl->dma_chans[i] = chan; -- 2.39.2