From nobody Mon Sep 29 21:08:04 2025 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 8975DC00140 for ; Tue, 16 Aug 2022 00:44:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345535AbiHPAoX (ORCPT ); Mon, 15 Aug 2022 20:44:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347426AbiHPAkt (ORCPT ); Mon, 15 Aug 2022 20:40:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A43318DC1C; Mon, 15 Aug 2022 13:38:56 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 6B3FD61185; Mon, 15 Aug 2022 20:38:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AA03C433C1; Mon, 15 Aug 2022 20:38:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595935; bh=5e+hyuj66mgvkBpjDbdBWNeP1w9LjavneXVUc/Qsum4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a3DnOFhffqp3Mj5pCYRW1hSQH7EQwLG2Ue3vMOrhq+n6lc+IvkzVcCxWDb1AvoIZ0 Db5XXwjaEe24NVtdICrZa61KAqloh2jdHuxVowiqlkSyLeb9TmNlaq+zwMYhZBO9VW S8UOwrHJkQ1XKoYpH64ZaDk/2UFQWZ/dIvZNeeaY= 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.19 0921/1157] ASoC: codecs: wsa881x: handle timeouts in resume path Date: Mon, 15 Aug 2022 20:04:37 +0200 Message-Id: <20220815180516.295036825@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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@l= inaro.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 f3a56f3ce487..02a438c6c4c7 100644 --- a/sound/soc/codecs/wsa881x.c +++ b/sound/soc/codecs/wsa881x.c @@ -1175,11 +1175,17 @@ static int __maybe_unused wsa881x_runtime_resume(st= ruct device *dev) struct sdw_slave *slave =3D dev_to_sdw_dev(dev); struct regmap *regmap =3D dev_get_regmap(dev, NULL); struct wsa881x_priv *wsa881x =3D dev_get_drvdata(dev); + unsigned long time; =20 gpiod_direction_output(wsa881x->sd_n, 1); =20 - wait_for_completion_timeout(&slave->initialization_complete, - msecs_to_jiffies(WSA881X_PROBE_TIMEOUT)); + time =3D 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; + } =20 regcache_cache_only(regmap, false); regcache_sync(regmap); --=20 2.35.1