Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3014364rwb; Mon, 15 Aug 2022 16:10:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR42LBcCVQ+4VoCGW2Mw73E0LOOzvPaD3zpPBw2YE0wCD5liSc5ueq3I0iz/HPuhZtthrXNj X-Received: by 2002:a17:907:7619:b0:730:d709:a2f0 with SMTP id jx25-20020a170907761900b00730d709a2f0mr11902843ejc.673.1660605020499; Mon, 15 Aug 2022 16:10:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605020; cv=none; d=google.com; s=arc-20160816; b=c45otZaoZIe3bGpIR9flIQYrdj8APVBBkLPoV4Bx3EN+yZIG9bTBnCPMpz/XVmJyGt EI4Jwno6ZqLg4+5luTXyrmN8Mu7UlBg55E2Y2TI+ViIAnJl7K9WUJeo+unfs9WEYFl8v MqHRf025q87MycuoKqF5LjQSNuKhnRSCCb5NfuR1tOZ8Y5SBjUEvETl7g4aMOkCL3IIh X8DrtvU3AD74NQvaaX868wgp7BknYTSpZyOzzgeBEtgRAzJj306QGUUXzrKOQAticMb5 RveWjxwB9jjSeZUX7iBB07Tb1Jvka4pgILB3ICToQECJNcpu73JHadsM6cwXh3N/+8P9 /1/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0JQYles/P4BJBBoO6OLOCKbUMewM/roqbZbMZLcCtOE=; b=xk2MvpjflosXk80BrEoi03qK7tjgEUAmEqGni9k42JUQwgYMRu8Dd7PeCxazCg6gg0 c9NH1CUSGz/6aIpWfdPIu7B2usKmNbAqNPoxR0VsrfLS+hp+xqhnAhDcPWuucEtAIkc6 bg0qiBFkG3aFe7XM4c1Zl5WoDJ+iFDuXeom9/4NJ6PWkoE/vzV0xHfHhe63Th0fHorUy fuEssPJ1OpD7OfPaXQ6JSqC3vN3YkRBONZzNNH7rR7w74sfo1E+KRtr2smCOaP2NQfAm 7DNgslluSTgU4jwUWbN2qLe2C0sXur0NBMdRuI+LmZO82INNk9guPuEZuDsVvKG6KDNO qKew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XF89TOx+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm22-20020a170907949600b0073151a536f7si8365272ejc.313.2022.08.15.16.09.54; Mon, 15 Aug 2022 16:10:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XF89TOx+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349832AbiHOWfO (ORCPT + 99 others); Mon, 15 Aug 2022 18:35:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351078AbiHOW1e (ORCPT ); Mon, 15 Aug 2022 18:27:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D817641D39; Mon, 15 Aug 2022 12:47:05 -0700 (PDT) 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 94CBAB80EB2; Mon, 15 Aug 2022 19:47:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C38A5C433D7; Mon, 15 Aug 2022 19:47:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592823; bh=ZcY8ootTVmsrvVa0ppEC/BOYMKO/1AIrNuHec3gCNc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XF89TOx+3yg9qB3iOyReuI2VvefZxYKntM3o2qbiFriR4j1uL3d95qib0JN9lR7z9 IGsNPmA1/qZDwP5BMe/VggLQSiA/ViccbHPxBUWfDvWvdHia5WgNfnk+Dx/X36DWae 0oVKCIkoEsxXk56EnIiWfdPS2DlLjXrTPjbmk1Iw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Srinivas Kandagatla , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0850/1095] ASoC: codecs: wsa881x: handle timeouts in resume path Date: Mon, 15 Aug 2022 20:04:09 +0200 Message-Id: <20220815180504.497172715@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Srinivas Kandagatla [ Upstream commit cf6af24b54903f9f70c29b3e5b19cb72cc862d60 ] Currently we do not check if SoundWire slave initialization timeout expired before continuing to access its registers. Its possible that the registers are not accessible if timeout is expired. Handle this by returning timeout in resume path. Reported-by: Pierre-Louis Bossart Fixes: 8dd552458361 ("ASoC: codecs: wsa881x: add runtime pm support") Signed-off-by: Srinivas Kandagatla Reviewed-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220630130023.9308-1-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wsa881x.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/wsa881x.c b/sound/soc/codecs/wsa881x.c index 616b26c70c3b..649c7e73f774 100644 --- a/sound/soc/codecs/wsa881x.c +++ b/sound/soc/codecs/wsa881x.c @@ -1174,11 +1174,17 @@ static int __maybe_unused wsa881x_runtime_resume(struct device *dev) struct sdw_slave *slave = dev_to_sdw_dev(dev); struct regmap *regmap = dev_get_regmap(dev, NULL); struct wsa881x_priv *wsa881x = dev_get_drvdata(dev); + unsigned long time; gpiod_direction_output(wsa881x->sd_n, 1); - wait_for_completion_timeout(&slave->initialization_complete, - msecs_to_jiffies(WSA881X_PROBE_TIMEOUT)); + time = wait_for_completion_timeout(&slave->initialization_complete, + msecs_to_jiffies(WSA881X_PROBE_TIMEOUT)); + if (!time) { + dev_err(dev, "Initialization not complete, timed out\n"); + gpiod_direction_output(wsa881x->sd_n, 0); + return -ETIMEDOUT; + } regcache_cache_only(regmap, false); regcache_sync(regmap); -- 2.35.1