aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorJustin Stitt <justinstitt@google.com>2023-08-09 21:05:17 +0000
committerCorey Minyard <minyard@acm.org>2023-08-15 15:46:06 -0500
commitd40f09c1a23024f0e550d9423f4d389672e1dfaf (patch)
treecad3603e870b4c678470a5e83709a84c462e08c5 /drivers/char
parentb02bb79eee074f07acdfde540f2d4fe2a04471d8 (diff)
downloadlinux-d40f09c1a23024f0e550d9423f4d389672e1dfaf.tar.gz
ipmi_si: fix -Wvoid-pointer-to-enum-cast warning
With W=1 we see the following warning: | drivers/char/ipmi/ipmi_si_platform.c:272:15: error: \ | cast to smaller integer type 'enum si_type' from \ | 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] | 272 | io.si_type = (enum si_type) match->data; | | ^~~~~~~~~~~~~~~~~~~~~~~~~~ This is due to the fact that the `si_type` enum members are int-width and a cast from pointer-width down to int will cause truncation and possible data loss. Although in this case `si_type` has only a few enumerated fields and thus there is likely no data loss occurring. Nonetheless, this patch is necessary to the goal of promoting this warning out of W=1. Link: https://github.com/ClangBuiltLinux/linux/issues/1902 Link: https://lore.kernel.org/llvm/202308081000.tTL1ElTr-lkp@intel.com/ Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Justin Stitt <justinstitt@google.com> Message-Id: <20230809-cbl-1902-v1-1-92def12d1dea@google.com> Signed-off-by: Corey Minyard <minyard@acm.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/ipmi/ipmi_si_platform.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/ipmi/ipmi_si_platform.c b/drivers/char/ipmi/ipmi_si_platform.c
index 70f73911457b5..c3d8ac7873baa 100644
--- a/drivers/char/ipmi/ipmi_si_platform.c
+++ b/drivers/char/ipmi/ipmi_si_platform.c
@@ -269,7 +269,7 @@ static int of_ipmi_probe(struct platform_device *pdev)
}
memset(&io, 0, sizeof(io));
- io.si_type = (enum si_type) match->data;
+ io.si_type = (unsigned long) match->data;
io.addr_source = SI_DEVICETREE;
io.irq_setup = ipmi_std_irq_setup;