From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Date: Sat, 26 Sep 2009 07:29:26 -0500 Subject: [U-Boot] [PATCH v2] OMAP3 MMC: Fix warning dereferencing type-punned pointer In-Reply-To: <4ABDAA51.5000802@googlemail.com> References: <1253903433-17455-1-git-send-email-dirk.behme@googlemail.com> <4ABD234C.5080408@windriver.com> <4ABDAA51.5000802@googlemail.com> Message-ID: <4ABE0926.7050005@windriver.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dirk Behme wrote: > Tom wrote: >> Dirk Behme wrote: >>> Fix warning >>> >>> dereferencing type-punned pointer will break strict-aliasing rules >>> >>> Signed-off-by: Dirk Behme >>> CC: Steve Sakoman >>> >> >> This may be improved by consolidating the unions into the omap3 mmc.h >> file >> and using a pointer to union in the mmc_send_cmd. > > Hmmh, I'm not so familiar with unions ;) But moving > > union { > unsigned int resp[4]; > mmc_resp_r3 r3; > mmc_resp_r6 r6; > } mmc_resp; > > and > > union { > unsigned int resp[4]; > mmc_csd_reg_t Card_CSD; > } mmc_resp; > > into the omap3 mmc.h would mean to make them global and to permanently > allocate the space for resp[4]? That is, make local variables allocated > locally (on stack?) move to global variables using (wasting?) some > additional memory? If so, I'd like to keep stuff local as done by the > original version. Sorry if I missed something ;) > I ment just the declaration like union mmc_resp_t { unsigned int resp[4]; mmc_resp_r3 r3; mmc_resp_r6 r6; mmc_csd_reg_t Card_CSD; }; variables would still be defined in the C file. Tom > Best regards > > Dirk >