From: Krzysztof Kozlowski <krzk@kernel.org>
To: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
Tudor Ambarus <tudor.ambarus@linaro.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Cc: stable@vger.kernel.org
Subject: Re: [PATCH] firmware: exynos-acpm: Drop fake 'const' on handle pointer
Date: Mon, 23 Feb 2026 20:55:14 +0100 [thread overview]
Message-ID: <f44fa4d8-93de-4010-b1ee-d4e44d1d797a@kernel.org> (raw)
In-Reply-To: <20260223193416.532231-2-krzysztof.kozlowski@oss.qualcomm.com>
On 23/02/2026 20:34, Krzysztof Kozlowski wrote:
> All the functions operating on the 'handle' pointer are claiming it is a
> pointer to const thus they should not modify the handle. In fact that's
> a false statement, because first thing these functions do is drop the
> cast to const with container_of:
>
> struct acpm_info *acpm = handle_to_acpm_info(handle);
>
> And with such cast the handle is easily writable with simple:
>
> acpm->handle.ops.pmic_ops.read_reg = NULL;
>
> The code is not correct logically, either, because functions like
> acpm_get_by_node() and acpm_handle_put() are meant to modify the handle
> reference counting, thus they must modify the handle. They could not
> work with handle being pointer to const.
>
> The code does not have actual visible bug, but incorrect 'const'
> annotations could lead to incorrect compiler decisions.
>
> Fixes: a88927b534ba ("firmware: add Exynos ACPM protocol driver")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
>
> ---
>
> I will have more patches for more drivers like TI, ARM SCMI...
> ---
> drivers/firmware/samsung/exynos-acpm-dvfs.c | 4 +-
> drivers/firmware/samsung/exynos-acpm-dvfs.h | 4 +-
> drivers/firmware/samsung/exynos-acpm-pmic.c | 10 ++---
> drivers/firmware/samsung/exynos-acpm-pmic.h | 10 ++---
> drivers/firmware/samsung/exynos-acpm.c | 16 ++++----
> drivers/firmware/samsung/exynos-acpm.h | 2 +-
> .../firmware/samsung/exynos-acpm-protocol.h | 40 ++++++++-----------
> 7 files changed, 41 insertions(+), 45 deletions(-)
I forgot about clocks, so there will be a v2.
Best regards,
Krzysztof
prev parent reply other threads:[~2026-02-23 19:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 19:34 [PATCH] firmware: exynos-acpm: Drop fake 'const' on handle pointer Krzysztof Kozlowski
2026-02-23 19:55 ` Krzysztof Kozlowski [this message]
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=f44fa4d8-93de-4010-b1ee-d4e44d1d797a@kernel.org \
--to=krzk@kernel.org \
--cc=alim.akhtar@samsung.com \
--cc=krzysztof.kozlowski@oss.qualcomm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tudor.ambarus@linaro.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