#2873 closed defect (fixed)

src/c/src/lib/libbsp/arm/raspberrypi/i2c/i2c.c:320: defective error checking ?

Reported by: David Binderman Owned by: Gedare Bloom <gedare@…>
Priority: normal Milestone: 5.1
Component: arch/arm Version: 4.11
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

src/c/src/lib/libbsp/arm/raspberrypi/i2c/i2c.c:320]: (style) Checking if unsigned variable 'rv' is less than zero.

Source code is

rv = rpi_i2c_setup_transfer(bus);

if ( rv < 0 ) {

but

uint32_t rv = 0;

and

static int rpi_i2c_setup_transfer(rpi_i2c_bus *bus)

Suggest put return value into an int local variable, then
sanity check it, then assign it to rv.

Change History (6)

comment:1 Changed on Jan 19, 2017 at 8:35:03 PM by Gedare Bloom <gedare@…>

Owner: set to Gedare Bloom <gedare@…>
Resolution: fixed
Status: newclosed

In 70e8abf3917c93ab085ca77fee379df9fa000183/rtems:

Error: Processor CommitTicketReference failed
/data/trac/repo/rtems.git does not appear to be a Git repository.

comment:2 Changed on Feb 5, 2017 at 2:07:37 AM by Joel Sherrill

This ticket is closed but I would like to know what you are running to spot these issues and what settings.

I would like to make sure that eventually we are running the same thing as a project. I would have emailed directly but couldn't find your email.

Thanks.

--joel

comment:3 Changed on Feb 5, 2017 at 9:06:38 AM by David Binderman

I would like to know what you are running to spot these issues and what settings.

I run a static C / C++ analyser called cppcheck, available from sourceforge.

http://cppcheck.sourceforge.net/

The latest released version would probably work ok, but I use the current development version.
I use flag --enable=all and I've tweeked the source of cppcheck as well.

BTW, if I could figure out how to build rtems on Linux, then I could run the latest
development versions of clang and gcc over rtems and possibly get some interesting warnings.

I would like to make sure that eventually we are running the same thing as a project.

I have been doing this myself for about a year or so. I'd be more than happy
to help and share my results.

I would have emailed directly but couldn't find your email.

dcb 314 at hotmail dot com. Feel free to chat offline.

comment:4 Changed on May 11, 2017 at 7:31:02 AM by Sebastian Huber

Milestone: 4.124.12.0

comment:5 Changed on Oct 16, 2017 at 6:24:30 AM by Sebastian Huber

Component: unspecifiedarch/arm

comment:6 Changed on Nov 9, 2017 at 6:27:14 AM by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

Note: See TracTickets for help on using tickets.