#1308 closed defect (fixed)

m68k/mcf5206elite/i2c/i2c.c: questionable volatile use-case

Reported by: Ralf Corsepius Owned by: thomas.doerfler
Priority: normal Milestone: 4.9
Component: bsps Version: 4.9
Severity: normal Keywords:
Cc: joel.sherrill@…, sebastian.huber@… Blocked By:
Blocking:

Description

c/src/lib/libbsp/m68k/mcf5206elite/i2c/i2c.c
contains this code:

static rtems_status_code
i2c_transfer_wait_poll(i2c_bus_number bus, i2c_message *msg, int nmsg)
{

volatile bool poll_done_flag;
rtems_status_code sc;
poll_done_flag = false;
sc = i2c_transfer(bus, nmsg, msg, i2c_transfer_poll_done_func,

(uint32_t)&poll_done_flag);

...

I.e. it passes the address of a local "volatile" variable down to other functions.

IMO, this code abuses volatile and is likely broken.

I am inclined to think, a "static bool poll_done_flags" (either global or inside
of i2c_transfer_wait_poll()) should be used instead.

Change History (5)

comment:1 Changed on 09/05/08 at 12:36:34 by Joel Sherrill

Owner: changed from Joel Sherrill to thomas.doerfler

comment:2 Changed on 09/05/08 at 12:36:58 by Joel Sherrill

Cc: sebastian.huber@… joel.sherrill@… added

comment:3 Changed on 09/05/08 at 13:45:18 by Ralf Corsepius

blocked: 1309

comment:4 Changed on 09/08/08 at 10:22:10 by thomas.doerfler

Resolution: fixed
Status: newclosed

comment:5 Changed on 09/08/08 at 12:36:03 by Joel Sherrill

Type issue has been address.

Note: See TracTickets for help on using tickets.