From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
Mark Brown <broonie@kernel.org>, Sasha Levin <sashal@kernel.org>,
heiko@sntech.de, nathan@kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, llvm@lists.linux.dev
Subject: [PATCH AUTOSEL 6.18-6.12] ASoC: rockchip: Fix Wvoid-pointer-to-enum-cast warning (again)
Date: Sun, 14 Dec 2025 19:41:21 -0500 [thread overview]
Message-ID: <20251215004145.2760442-4-sashal@kernel.org> (raw)
In-Reply-To: <20251215004145.2760442-1-sashal@kernel.org>
From: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
[ Upstream commit 57d508b5f718730f74b11e0dc9609ac7976802d1 ]
'version' is an enum, thus cast of pointer on 64-bit compile test with
clang W=1 causes:
rockchip_pdm.c:583:17: error: cast to smaller integer type 'enum rk_pdm_version' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
This was already fixed in commit 49a4a8d12612 ("ASoC: rockchip: Fix
Wvoid-pointer-to-enum-cast warning") but then got bad in
commit 9958d85968ed ("ASoC: Use device_get_match_data()").
Discussion on LKML also pointed out that 'uintptr_t' is not the correct
type and either 'kernel_ulong_t' or 'unsigned long' should be used,
with several arguments towards the latter [1].
Link: https://lore.kernel.org/r/CAMuHMdX7t=mabqFE5O-Cii3REMuyaePHmqX+j_mqyrn6XXzsoA@mail.gmail.com/ [1]
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://patch.msgid.link/20251203141644.106459-2-krzysztof.kozlowski@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
## Summary Analysis
### What the commit fixes
This is a **build fix** that prevents a compilation error when building
with clang and W=1:
```
error: cast to smaller integer type 'enum rk_pdm_version' from 'const
void *' [-Werror,-Wvoid-pointer-to-enum-cast]
```
The issue is that on 64-bit systems, casting directly from `const void
*` (64 bits) to an enum (typically 32 bits) triggers a truncation
warning. Using `(unsigned long)` as an intermediate cast avoids this
because `unsigned long` matches the pointer size.
### Classification
This falls clearly into the **BUILD FIX** exception category which is
explicitly allowed for stable trees. Build fixes that prevent
compilation are critical for users who need to build the kernel.
### Scope and Risk
- **Change**: Single line - only changing the cast type
- **Files touched**: 1 file
- **Risk**: Extremely low - the runtime behavior is identical; only the
compile-time representation differs
- **Functional equivalence**: The value stored in `pdm->version` is the
same either way
### Applicability to Stable Trees
The regressing commit 9958d85968ed went into v6.7-rc1. Therefore:
- Stable trees **v6.6.y and earlier**: NOT affected (don't have the
regression)
- Stable trees **v6.7.y and later**: Affected and would benefit from
this fix
### Stable Criteria Assessment
| Criterion | Assessment |
|-----------|------------|
| Obviously correct | ✓ Yes - standard pattern for void pointer to enum
cast |
| Fixes real bug | ✓ Yes - compilation failure |
| Small scope | ✓ Yes - 1 line change |
| No new features | ✓ Correct - pure bug fix |
| Tested | ✓ Accepted by maintainer |
### Additional Factors
- This is a **regression fix** - the same issue was previously fixed in
commit 49a4a8d12612 but regressed
- LKML discussion confirms `unsigned long` as the appropriate fix
- Signed off by both author and subsystem maintainer (Mark Brown)
### Risk vs Benefit
- **Risk**: Near zero - compile-time only change, no runtime behavior
modification
- **Benefit**: Enables compilation with clang W=1 on 64-bit platforms
This is an excellent stable backport candidate. It's a minimal, low-risk
build fix that allows users to compile the kernel in a common
configuration. Build fixes are explicitly mentioned as appropriate for
stable trees, and this one is as safe as they come - a single-line cast
change with no runtime impact.
**YES**
sound/soc/rockchip/rockchip_pdm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/rockchip/rockchip_pdm.c b/sound/soc/rockchip/rockchip_pdm.c
index c1ee470ec6079..c69cdd6f24994 100644
--- a/sound/soc/rockchip/rockchip_pdm.c
+++ b/sound/soc/rockchip/rockchip_pdm.c
@@ -580,7 +580,7 @@ static int rockchip_pdm_probe(struct platform_device *pdev)
if (!pdm)
return -ENOMEM;
- pdm->version = (enum rk_pdm_version)device_get_match_data(&pdev->dev);
+ pdm->version = (unsigned long)device_get_match_data(&pdev->dev);
if (pdm->version == RK_PDM_RK3308) {
pdm->reset = devm_reset_control_get(&pdev->dev, "pdm-m");
if (IS_ERR(pdm->reset))
--
2.51.0
next prev parent reply other threads:[~2025-12-15 0:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-15 0:41 [PATCH AUTOSEL 6.18-6.17] ALSA: hda/realtek: Add support for ASUS UM3406GA Sasha Levin
2025-12-15 0:41 ` [PATCH AUTOSEL 6.18-6.1] smb/client: fix NT_STATUS_NO_DATA_DETECTED value Sasha Levin
2025-12-15 0:41 ` [PATCH AUTOSEL 6.18-6.17] ALSA: hda: intel-dsp-config: Prefer legacy driver as fallback Sasha Levin
2025-12-15 23:29 ` Askar Safin
2026-01-07 11:16 ` Sasha Levin
2026-01-11 12:04 ` Askar Safin
2026-01-11 12:24 ` Greg KH
2026-01-11 16:01 ` Askar Safin
2026-01-12 10:54 ` Greg KH
2026-01-15 14:34 ` [PATCH 6.12.y] " Askar Safin
2026-01-15 14:40 ` [PATCH AUTOSEL 6.18-6.17] " Askar Safin
2025-12-15 0:41 ` Sasha Levin [this message]
2025-12-15 0:41 ` [PATCH AUTOSEL 6.18-5.10] NFSv4: ensure the open stateid seqid doesn't go backwards Sasha Levin
2025-12-15 0:41 ` [PATCH AUTOSEL 6.18-6.1] bcache: fix improper use of bi_end_io Sasha Levin
2025-12-15 0:41 ` [PATCH AUTOSEL 6.18-5.10] NFS: Fix up the automount fs_context to use the correct cred Sasha Levin
2025-12-15 0:41 ` [PATCH AUTOSEL 6.18-6.1] smb/client: fix NT_STATUS_DEVICE_DOOR_OPEN value Sasha Levin
2025-12-15 0:41 ` [PATCH AUTOSEL 6.18-6.1] smb/client: fix NT_STATUS_UNABLE_TO_FREE_VM value Sasha Levin
2025-12-15 0:41 ` [PATCH AUTOSEL 6.18-6.12] drm/amd/display: shrink struct members Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251215004145.2760442-4-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=broonie@kernel.org \
--cc=heiko@sntech.de \
--cc=krzysztof.kozlowski@oss.qualcomm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=patches@lists.linux.dev \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox