[PATCH] firmware: exynos-acpm: Drop fake 'const' on handle pointer

Krzysztof Kozlowski krzk at kernel.org
Mon Feb 23 11:55:14 PST 2026


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 at vger.kernel.org>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski at 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



More information about the linux-arm-kernel mailing list