From nobody Mon Dec 29 00:46:05 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 66814C4167B for ; Sun, 3 Dec 2023 22:22:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233978AbjLCWWc (ORCPT ); Sun, 3 Dec 2023 17:22:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjLCWWa (ORCPT ); Sun, 3 Dec 2023 17:22:30 -0500 Received: from mail.horus.com (mail.horus.com [78.46.148.228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CC4ADA for ; Sun, 3 Dec 2023 14:22:36 -0800 (PST) Received: from [192.168.1.22] (193-81-119-54.adsl.highway.telekom.at [193.81.119.54]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mail.horus.com (Postfix) with ESMTPSA id 461A6640D9; Sun, 3 Dec 2023 23:22:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=horus.com; s=20180324; t=1701642154; bh=S+NxOg1Q99NWR3DORvjhpBwkWsMbImN66Ggyq/z+X+w=; h=From:To:Cc:Subject:Date:From; b=PZj6DUZ1DkcMZ1sVexpfeRINlMzkmmzCFcZIG/MV0TXyrAlY5msfSTUjy52iJTG/h HNZeCSNpOzSZ2otsEfsz0vIrYNrOcr/BjlanFv6whZm5tlB8wGzLOUm1R154dLmofQ /1bNFMd+ZDFrXbwrhSbi3sPXf0+rBz9ciNbsiFQk= Received: by camel3.lan (Postfix, from userid 1000) id 6C5F254029B; Sun, 3 Dec 2023 23:22:33 +0100 (CET) From: Matthias Reichl To: Mark Brown Cc: linux-kernel@vger.kernel.org, Matthias Reichl Subject: [PATCH] regmap: fix bogus error on regcache_sync success Date: Sun, 3 Dec 2023 23:22:16 +0100 Message-Id: <20231203222216.96547-1-hias@horus.com> X-Mailer: git-send-email 2.39.2 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" Since commit 0ec7731655de ("regmap: Ensure range selector registers are updated after cache sync") opening pcm512x based soundcards fail with EINVAL and dmesg shows sync cache and pm_runtime_get errors: [ 228.794676] pcm512x 1-004c: Failed to sync cache: -22 [ 228.794740] pcm512x 1-004c: ASoC: error at snd_soc_pcm_component_pm_runt= ime_get on pcm512x.1-004c: -22 This is caused by the cache check result leaking out into the regcache_sync return value. Fix this by making the check local-only, as the comment above the regcache_read call states a non-zero return value means there's nothing to do so the return value should not be altered. Fixes: 0ec7731655de ("regmap: Ensure range selector registers are updated a= fter cache sync") Cc: stable@vger.kernel.org Signed-off-by: Matthias Reichl --- drivers/base/regmap/regcache.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 92592f944a3d..ac63a73ccdaa 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c @@ -410,8 +410,7 @@ int regcache_sync(struct regmap *map) rb_entry(node, struct regmap_range_node, node); =20 /* If there's nothing in the cache there's nothing to sync */ - ret =3D regcache_read(map, this->selector_reg, &i); - if (ret !=3D 0) + if (regcache_read(map, this->selector_reg, &i) !=3D 0) continue; =20 ret =3D _regmap_write(map, this->selector_reg, i); --=20 2.39.2