[U-Boot] [PATCH] board/linkstation/ide.c: Fix compile warning
Scott Wood
scottwood at freescale.com
Fri Sep 11 19:54:11 CEST 2009
On Fri, Sep 11, 2009 at 02:00:06PM +0200, Wolfgang Denk wrote:
> In message <Pine.LNX.4.64.0909111259280.6139 at axis700.grange> you wrote:
> > On Fri, 11 Sep 2009, Wolfgang Denk wrote:
> > > Fix warning: ide.c:60: warning: dereferencing type-punned pointer will
> > > break strict-aliasing rules
> > >
> > > Signed-off-by: Wolfgang Denk <wd at denx.de>
> > > Cc: Guennadi Liakhovetski <lg at denx.de>
> > > ---
> > > board/linkstation/ide.c | 4 +++-
> > > 1 files changed, 3 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/board/linkstation/ide.c b/board/linkstation/ide.c
> > > index 2c89d62..5dd1d0e 100644
> > > --- a/board/linkstation/ide.c
> > > +++ b/board/linkstation/ide.c
> > > @@ -54,10 +54,12 @@ int ide_preinit (void)
> > > if (devbusfn == -1)
> > > devbusfn = pci_find_device(PCI_VENDOR_ID_ITE,PCI_DEVICE_ID_ITE_8212,0);
> > > if (devbusfn != -1) {
> > > + ulong *ide_bus_offset_ptr = &ide_bus_offset[0];
> > > +
> > > status = 0;
> > >
> > > pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_0,
> > > - (u32 *) &ide_bus_offset[0]);
> > > + (u32 *)ide_bus_offset_ptr);
> >
> > Can we also use this occasion to get rid of this typecast?
>
> No, as this would result in
>
> ide.c:62: warning: passing argument 3 of 'pci_read_config_dword' from
> incompatible pointer type
What about something like:
u32 ide_bus_offset32;
pci_read_config_dword(..., &ide_bus_offset32);
ide_bus_offset[0] = ide_bus_offset32;
-Scott
More information about the U-Boot
mailing list