#2876 assigned defect

src/c/src/lib/libbsp/shared/gpio.c:251: broken error checking ?

Reported by: David Binderman Owned by: Needs Funding
Priority: normal Milestone: Indefinite
Component: unspecified Version: 4.11
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

src/c/src/lib/libbsp/shared/gpio.c:251]: (style) Checking if unsigned variable 'rv' is less than zero.

Source code is

rv = debounce_switch(interrupt_state);

/* If the handler call was caused by a switch bounce,

  • ignores and move on. */

if ( rv < 0 ) {

but

static int debounce_switch(gpio_pin_interrupt_state *interrupt_state)

and

uint8_t rv;

Attachments (1)

2876-Fix-gpio-warning-error-checking.patch (1.1 KB) - added by Stavros Passas on May 22, 2017 at 9:38:08 PM.
suggested fix

Download all attachments as: .zip

Change History (3)

comment:1 Changed on Feb 15, 2017 at 2:20:42 PM by Sebastian Huber

Milestone: 4.12Indefinite
Owner: set to Needs Funding
Status: newassigned

comment:2 Changed on May 22, 2017 at 9:37:38 PM by Stavros Passas

Mainly debounce_switch returns an integer and -1 if an error occurs. Thus by changing rv to int this error checking is fixed. I think we should change both of them to int32_t for consistency with the rest RTEMS.

Changed on May 22, 2017 at 9:38:08 PM by Stavros Passas

suggested fix

Note: See TracTickets for help on using tickets.