From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E2511EF0A4; Wed, 6 Nov 2024 12:49:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730897341; cv=none; b=mzM/DaJE3INCsEbXITnMlZGYxLJeBeYGIXXyiKEOfqHOEEKBvKnb0FKt4rCKnlDfhyRtNyPzdo4aAS9iidFUszC/G+fm1P9KZgfa6lKmOAX4CqBvI78/Xa3/SexcDcIutmlPupeARc+kLawuR2w5r+JGhffDatTfRy2snevd/e4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730897341; c=relaxed/simple; bh=TPSC1iz/CvajLxFJxpfTbwGurdhX/IxGBMGlOMHGaVc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hUGX/uD9spM2ZkA9aqzcoaM2oFpEvw+iug46DC+Q+lTCN4Iel9yDXEracXm3ltba725y+mSQnbyZYAM3Ic16PuL739PgMmxanbC67q4oaGmZFZndhuWH5l3D6AAzAg7X7NTI14BOxTxNhhKh/y3nVZSkycjpZHe1DOcCTj4L9DI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Qd8bo4LZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Qd8bo4LZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A3AAC4CECD; Wed, 6 Nov 2024 12:49:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1730897340; bh=TPSC1iz/CvajLxFJxpfTbwGurdhX/IxGBMGlOMHGaVc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qd8bo4LZzQCumxw8WtJwZMBwi1xkOmYDelNAtZsh5Eyvb1HDDdp0dADLse6QHnMaf eEz+5nRMjvLAugRwfMLDfu/ab3Qvej6yHINb1jM5eDgA9zwKGp1tpVQc0Pu0aXF3yj qr2sQgpC2PPOgrN+a9mCw4S/O5iX9A4igF7sWwJA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christophe JAILLET , Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 6.6 020/151] ASoC: cs42l51: Fix some error handling paths in cs42l51_probe() Date: Wed, 6 Nov 2024 13:03:28 +0100 Message-ID: <20241106120309.392208990@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241106120308.841299741@linuxfoundation.org> References: <20241106120308.841299741@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christophe JAILLET [ Upstream commit d221b844ee79823ffc29b7badc4010bdb0960224 ] If devm_gpiod_get_optional() fails, we need to disable previously enabled regulators, as done in the other error handling path of the function. Also, gpiod_set_value_cansleep(, 1) needs to be called to undo a potential gpiod_set_value_cansleep(, 0). If the "reset" gpio is not defined, this additional call is just a no-op. This behavior is the same as the one already in the .remove() function. Fixes: 11b9cd748e31 ("ASoC: cs42l51: add reset management") Signed-off-by: Christophe JAILLET Reviewed-by: Charles Keepax Link: https://patch.msgid.link/a5e5f4b9fb03f46abd2c93ed94b5c395972ce0d1.1729975570.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/cs42l51.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c index e4827b8c2bde4..6e51954bdb1ec 100644 --- a/sound/soc/codecs/cs42l51.c +++ b/sound/soc/codecs/cs42l51.c @@ -747,8 +747,10 @@ int cs42l51_probe(struct device *dev, struct regmap *regmap) cs42l51->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); - if (IS_ERR(cs42l51->reset_gpio)) - return PTR_ERR(cs42l51->reset_gpio); + if (IS_ERR(cs42l51->reset_gpio)) { + ret = PTR_ERR(cs42l51->reset_gpio); + goto error; + } if (cs42l51->reset_gpio) { dev_dbg(dev, "Release reset gpio\n"); @@ -780,6 +782,7 @@ int cs42l51_probe(struct device *dev, struct regmap *regmap) return 0; error: + gpiod_set_value_cansleep(cs42l51->reset_gpio, 1); regulator_bulk_disable(ARRAY_SIZE(cs42l51->supplies), cs42l51->supplies); return ret; -- 2.43.0