From nobody Tue Dec 16 17:53:53 2025 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 E4404548F7 for ; Fri, 19 Jul 2024 10:40:35 +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=1721385636; cv=none; b=jEZEVRBs4kLPsmvcRPwu7QMprz5zArJrsq0qmk/UIe85FA/s/xIYezw/lVz6f+YtQJDptUEoSI6zCSl/QIspRl6knxhu05RaFg+rYvpKKwsKF04p9FBJt5OLlNVF7s4ONvMsCHAeYOH25xWgdfJT2BM2gUzV63V6H06oa/GVb4U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721385636; c=relaxed/simple; bh=otxByGRbgGXdSpNWhBDtrzaTFR9ycy2O/8HXktzpNT4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=eVmf5PHUQvj0H02zrLO0zOOEid0b3XYc3bODe/tPXZ6i7CZAqPmBtZm1Z9WVCEstgI8Vx3D8hQVNWqCYKaPE4tZv4Qe8W+5s+jDiBHqXM/iy+0Ep6a7I8zHiVDS2e0SV2z9ea7ootUJmntJz2FQyQc/V0BVDnjACT6vSRBMeMtU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gqUEIEKr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gqUEIEKr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EAF8C32782; Fri, 19 Jul 2024 10:40:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721385635; bh=otxByGRbgGXdSpNWhBDtrzaTFR9ycy2O/8HXktzpNT4=; h=From:To:Cc:Subject:Date:From; b=gqUEIEKrMOZCFW19LLfOjJHCoNWDEXfSQeea3GB39/clLHY5NwVj9A4+onFIYH7/B pzj6xfwc3bs51mmyy+FJQb0ucRkVdt2OG8oK6cGTjJKRkt/KaCGxZiuOfy5vfjbsgl qz+/Zvrj5D9Y5FxmSEUa4ZyX5nqhPHOPjHKYb5nRql1OuuqZAqEFlj7MnOSpDUdPKP I5UbGAeL4giKIP2E/zduDmIR4Q7U8pYnx/QKfgCDNTBNEPDGhLUMRl9Z+HXFQLIPvr HW5MZG+DG+26I9hMpgUsXQGzPuG04v2mJ7Ma+ed8HATCku/NfgSP9jd8lvabzfpRyQ Z6FKFawPW3F/w== From: Arnd Bergmann To: Mark Brown , Greg Kroah-Hartman Cc: Arnd Bergmann , "Rafael J. Wysocki" , Richard Fitzgerald , Guenter Roeck , Colin Ian King , Andy Shevchenko , linux-kernel@vger.kernel.org Subject: [PATCH] regmap: maple: work around gcc-14.1 false-positive warning Date: Fri, 19 Jul 2024 12:40:24 +0200 Message-Id: <20240719104030.1382465-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann With gcc-14.1, there is a false-postive -Wuninitialized warning in regcache_maple_drop: drivers/base/regmap/regcache-maple.c: In function 'regcache_maple_drop': drivers/base/regmap/regcache-maple.c:113:23: error: 'lower_index' is used u= ninitialized [-Werror=3Duninitialized] 113 | unsigned long lower_index, lower_last; | ^~~~~~~~~~~ drivers/base/regmap/regcache-maple.c:113:36: error: 'lower_last' is used un= initialized [-Werror=3Duninitialized] 113 | unsigned long lower_index, lower_last; | ^~~~~~~~~~ I've created a reduced test case to see if this needs to be reported as a gcc, but it appears that the gcc-14.x branch already has a change that turns this into a more sensible -Wmaybe-uninitialized warning, so I ended up not reporting it so far. The reduced test case also produces a warning for gcc-13 and gcc-12 but I don't see that with the version in the kernel. Link: https://godbolt.org/z/oKbohKqd3 Link: https://lore.kernel.org/all/CAMuHMdWj=3DFLmkazPbYKPevDrcym2_HDb_U7Mb9= YE9ovrP0jJfA@mail.gmail.com/ Signed-off-by: Arnd Bergmann --- I'm still not convinced that this is the best solution, but I had no other ideas here. --- drivers/base/regmap/regcache-maple.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/base/regmap/regcache-maple.c b/drivers/base/regmap/reg= cache-maple.c index f0df2da6d522..2dea9d259c49 100644 --- a/drivers/base/regmap/regcache-maple.c +++ b/drivers/base/regmap/regcache-maple.c @@ -110,7 +110,8 @@ static int regcache_maple_drop(struct regmap *map, unsi= gned int min, struct maple_tree *mt =3D map->cache; MA_STATE(mas, mt, min, max); unsigned long *entry, *lower, *upper; - unsigned long lower_index, lower_last; + /* initialized to work around false-positive -Wuninitialized warning */ + unsigned long lower_index =3D 0, lower_last =3D 0; unsigned long upper_index, upper_last; int ret =3D 0; =20 --=20 2.39.2