Commit 38c2efa2 authored by Justin Stitt's avatar Justin Stitt Committed by Ulf Hansson

pmdomain: renesas: rmobile-sysc: fix -Wvoid-pointer-to-enum-cast warning

When building with clang 18 I see the following warning:
|      drivers/soc/renesas/rmobile-sysc.c:193:22: warning: cast to smaller integer
|               type 'enum pd_types' from 'const void *' [-Wvoid-pointer-to-enum-cast]
|        193 |                 add_special_pd(np, (enum pd_types)id->data);

This is due to the fact that `id->data` is a void* and `enum pd_types`
has the size of an integer. This cast from pointer-width to int-width
causes truncation and possible data loss. Instead, cast to `uintptr_t`
which has the same width as void*.
Reported-by: default avatarNathan Chancellor <nathan@kernel.org>
Closes: https://github.com/ClangBuiltLinux/linux/issues/1910Signed-off-by: default avatarJustin Stitt <justinstitt@google.com>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20230814-void-drivers-soc-renesas-rmobile-sysc-v1-1-6648dfd854de@google.comSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent d8237f87
......@@ -190,7 +190,7 @@ static void __init get_special_pds(void)
/* PM domains containing other special devices */
for_each_matching_node_and_match(np, special_ids, &id)
add_special_pd(np, (enum pd_types)id->data);
add_special_pd(np, (uintptr_t)id->data);
}
static void __init put_special_pds(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment