[RTEMS Project] #2873: src/c/src/lib/libbsp/arm/raspberrypi/i2c/i2c.c:320: defective error checking ?

RTEMS trac trac at rtems.org
Thu Jan 19 19:59:11 UTC 2017


#2873: src/c/src/lib/libbsp/arm/raspberrypi/i2c/i2c.c:320: defective error
checking ?
---------------------+------------------
 Reporter:  dcb      |      Owner:
     Type:  defect   |     Status:  new
 Priority:  normal   |  Milestone:  4.12
Component:  General  |    Version:  4.11
 Severity:  normal   |   Keywords:
---------------------+------------------
 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.

--
Ticket URL: <http://devel.rtems.org/ticket/2873>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list