Skip to content

Commit d40f09c

Browse files
JustinStittcminyard
authored andcommitted
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: ClangBuiltLinux#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>
1 parent b02bb79 commit d40f09c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/char/ipmi/ipmi_si_platform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ static int of_ipmi_probe(struct platform_device *pdev)
269269
}
270270

271271
memset(&io, 0, sizeof(io));
272-
io.si_type = (enum si_type) match->data;
272+
io.si_type = (unsigned long) match->data;
273273
io.addr_source = SI_DEVICETREE;
274274
io.irq_setup = ipmi_std_irq_setup;
275275

0 commit comments

Comments
 (0)