Skip to content

Commit da1c860

Browse files
Geoffroy Van Cutsemjren1
authored andcommitted
Fix compilation on Ubuntu 14.04
A couple of problems appeared on Ubuntu 14.04 (gcc 4.8.4) when we turned on additional compiler flags with commit 519c4285cf104a594776591075ee1c6ee4d61815a. This patch fixes these problems by adhering to the strict anti-aliasing rules and also initializing the 'tfd' variable where the compile believed it _could_ be used uninitialized. Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com> Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
1 parent f98a7ca commit da1c860

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

devicemodel/hw/pci/ahci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1478,7 +1478,7 @@ static void
14781478
atapi_mode_sense(struct ahci_port *p, int slot, uint8_t *cfis)
14791479
{
14801480
uint8_t *acmd;
1481-
uint32_t tfd;
1481+
uint32_t tfd =0;
14821482
uint8_t pc, code;
14831483
int len;
14841484

devicemodel/include/pci_core.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,14 @@ static inline void
270270
pci_set_cfgdata16(struct pci_vdev *pi, int offset, uint16_t val)
271271
{
272272
assert(offset <= (PCI_REGMAX - 1) && (offset & 1) == 0);
273-
*(uint16_t *)(pi->cfgdata + offset) = val;
273+
*(uint16_t *)((uint16_t *)pi->cfgdata + offset) = val;
274274
}
275275

276276
static inline void
277277
pci_set_cfgdata32(struct pci_vdev *pi, int offset, uint32_t val)
278278
{
279279
assert(offset <= (PCI_REGMAX - 3) && (offset & 3) == 0);
280-
*(uint32_t *)(pi->cfgdata + offset) = val;
280+
*(uint32_t *)((uint32_t *)pi->cfgdata + offset) = val;
281281
}
282282

283283
static inline uint8_t
@@ -291,14 +291,14 @@ static inline uint16_t
291291
pci_get_cfgdata16(struct pci_vdev *pi, int offset)
292292
{
293293
assert(offset <= (PCI_REGMAX - 1) && (offset & 1) == 0);
294-
return (*(uint16_t *)(pi->cfgdata + offset));
294+
return (*(uint16_t *)((uint16_t *)pi->cfgdata + offset));
295295
}
296296

297297
static inline uint32_t
298298
pci_get_cfgdata32(struct pci_vdev *pi, int offset)
299299
{
300300
assert(offset <= (PCI_REGMAX - 3) && (offset & 3) == 0);
301-
return (*(uint32_t *)(pi->cfgdata + offset));
301+
return (*(uint32_t *)((uint32_t *)pi->cfgdata + offset));
302302
}
303303

304304
#endif /* _PCI_CORE_H_ */

0 commit comments

Comments
 (0)