From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C71851E9B37 for ; Mon, 13 Jul 2026 05:03:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783919033; cv=none; b=tcddBhUD26smnMa1PZgCqHPSqDkjebDzmNlbLRA0eGEJa9thZuGAmAWBvbiKCNKsslw4Cok2yumdcxrzNtXKB/aWl0YAv3KaWQQF9dhLU1/aGWShLoo+QNPmsiXdN+rtbDmzimawn4g07qYlWdydNw2Jy6DrCQQtDo7N2KdS9os= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783919033; c=relaxed/simple; bh=rqn2PoF5poebkTCa6B8Yxh36blX/B8UQ1my3nZhOTFk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=XVBowMDkLe4gJRSYZkEJcWzMKNS+YHkdF0jzfFUiQyGKb39rpDtcuH1GyfVcAGqJc60wgSZVPe5BsJ9uRQmplBU47et38cV+LY1qAe/mYRdIcpJjmyq2vXAata8Z7NUScYW5Gl4y53KUUo84B9STlCtZCA8RoIIxOfkjBBW+0m8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WGCVJVAE; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WGCVJVAE" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2cac59f8b64so29898285ad.0 for ; Sun, 12 Jul 2026 22:03:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783919032; x=1784523832; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=rORoi9vSF7J7ID6gWdWITj/vYVWNW4l6d/liasSf3G0=; b=WGCVJVAEw/yIhqBrNnYIUwX/HfbfV8ktj52hP7P/AyWRixDQwTW5QA8q4wZ5uhdRUW ZaohdXvMlfWc6khYybpWas3dl6vxjjXhQk3+RNgfGOfsqKJxv6GfczFwcllZpmzKgW+s twZO/i4bYBEqsu8fe7/TrMQTpiYg0AMA/0F1GcDD1Njih7dYkTnTLir8GbsYcKlWqOJX NrWd/10EDyE3WZ/+Xh2WchUU6v3buIjwH7yj4AMpwZ/x/EU59SvHPUohMyC3urnTL/J+ Qs+Qg7UClpJJpMocpD/AZvMHwqz3PI39HuZtffLPSntsvxTDgqm8En2yPtk2HSzfv0Sc Obcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783919032; x=1784523832; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=rORoi9vSF7J7ID6gWdWITj/vYVWNW4l6d/liasSf3G0=; b=VX3nQAIEJxPZlcaQb/R2ScE2f9HNfeBfHzqa+ZiawT6FTKr4Fq9Ht0K2jBEsaQyUiN xjPtNRVBWyozrHsy5lp86Enh5FgZTcE3NfLjBetn0jbCIQc4sYmnLYf5b/64JR6sioLq bwL5nCu6hEJ1kbPVsAp2BirvQCVJDlMDBcxeHR+3kyU5R6oWkpDODh/Itk/DsN0c7M6r Cou6ysSkozJJGmo6kh22DekePnium1EKGEuILZGV4IecamnF0sEdEODZLTJV33GZN5JV w+64xBoXHj47BYbJunP9F6H5VnsRDN3irO2i9mEXrN0yrgKSRAzK5U6DydlvwF6Lixwh NZcQ== X-Forwarded-Encrypted: i=1; AHgh+RpfsC1EOBpKtVKdefGShtWb1wcxh8dEEmQ9jFx9WJixCGdaoaSLwKtrnt3YOT6gZMQmQguFi/vIENTE1U4=@vger.kernel.org X-Gm-Message-State: AOJu0YwKmF7YH4IQ/+wjKN6lKsjyojmcEom/bXHj6lxXFD/dDmoaq//P Py4WIFszJAxTnSYCq+cbdDKF/awJKMe+zh0D30zY64x9kZ9aEPIRHrJQ X-Gm-Gg: AfdE7cktw8Yu/p2ckmxLVnm5+iE94iKb6SBbQl3pTaDW4UYIsOOqniZKaDT3+XgYTEY 3j8z+5m6RLyi2GJ3GCggMFRejmgPRSOeO8mb5yUrv+UEjc3NxUnJcpE0SG6Hw2b2NBhmnr5E7Ap mmMjkUPOjfPwk07WcfJwuriJsy2qaqaSjirFvObnA3+iAUS4emvp3QVyNJ+EfPBzeXoYuhZFXWp 3VKbFfzVSiOFv5XqbWLmyO7Lj0nWuTN3Bj8jLbMrR69ZT5zmsnkC00qjINW0nqLa16dvMlnGdr7 m89vZKv7zVDmaZ+Y38GJhsTurA/AMxlzPHuwlPr55Qzt5jeyMtYuiGz77lefy86fIBi/WREv3sy Q8Rxy3jrgJDniBeLnv2U3H+mQdhmtzIyH4MJiMyCPGeFQFQZLNBW6B+Y7E8p374pOd7drcouOaG czMhFOQLkOjmp8fjOmCwd6pmNf+Gf6uiV1qMgckpy7K6TD/fGB3/5ON2MqcQ== X-Received: by 2002:a05:6300:218c:b0:3bf:6c08:fb82 with SMTP id adf61e73a8af0-3c1109ecd0fmr8215956637.50.1783919032100; Sun, 12 Jul 2026 22:03:52 -0700 (PDT) Received: from phuc-desktop.. ([183.91.15.56]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-313c50c70c9sm21927368eec.29.2026.07.12.22.03.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jul 2026 22:03:51 -0700 (PDT) From: phucduc.bui@gmail.com To: Mark Brown , Greg Kroah-Hartman , rafael@kernel.org Cc: Danilo Krummrich , linux-kernel@vger.kernel.org, driver-core@lists.linux.dev, bui duc phuc Subject: [PATCH 0/2] regmap: Improve error handling in regcache_sync() Date: Mon, 13 Jul 2026 12:03:10 +0700 Message-ID: <20260713050312.38729-1-phucduc.bui@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: bui duc phuc Hi all, While working on a cleanup series converting mutex and spinlock usage to guard() helpers, I received review feedback that regcache_sync() still has a goto-based error path. https://lore.kernel.org/all/95f5d6ec-ecc5-4090-ac04-27cdcdc21b8a@sirena.org.uk/ Since guard() helpers should not be mixed with goto-based cleanup, I looked into whether the error handling could be simplified. During that review, I noticed two issues in the current implementation of regcache_sync(): 1. Cache synchronization errors can be overwritten by the result of selector register updates. 2. cache_dirty is not updated if rewriting a selector register fails, leaving it inconsistent with the cache and hardware state. Together, these changes make the failure semantics of regcache_sync() clearer and eliminate the need for callers to invoke regcache_mark_dirty() after regcache_sync() fails. Best regards, Phuc bui duc phuc (2): regcache: Preserve cache synchronization errors in regcache_sync() regcache: Mark cache dirty if selector register rewrite fails drivers/base/regmap/regcache.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) -- 2.43.0