From ed3eb6ebe2d97c429540abba78ac8a36ecf8f757 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sat, 4 Feb 2006 21:37:39 +0000 Subject: [PATCH] Don't type pun accidentally. Instead, be explicit that we're type punning with an union so that the compiler knows. --- sys/dev/firewire/fwcrom.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/dev/firewire/fwcrom.c b/sys/dev/firewire/fwcrom.c index 45bedee9c4d..8a53bc7fae7 100644 --- a/sys/dev/firewire/fwcrom.c +++ b/sys/dev/firewire/fwcrom.c @@ -409,13 +409,15 @@ crom_add_quad(struct crom_chunk *chunk, uint32_t entry) int crom_add_entry(struct crom_chunk *chunk, int key, int val) { - struct csrreg *reg; - uint32_t i; + union + { + struct csrreg reg; + uint32_t i; + } foo; - reg = (struct csrreg *)&i; - reg->key = key; - reg->val = val; - return(crom_add_quad(chunk, (uint32_t) i)); + foo.reg.key = key; + foo.reg.val = val; + return (crom_add_quad(chunk, foo.i)); } int -- 2.45.2