[RTEMS Project] #2685: c/src/lib/libbsp/arm/atsam/network/if_atsam.c:409: possible bad if statement

RTEMS trac trac at rtems.org
Thu Apr 7 21:07:24 UTC 2016


#2685: c/src/lib/libbsp/arm/atsam/network/if_atsam.c:409: possible bad if
statement
---------------------+--------------------
 Reporter:  dcb      |      Owner:
     Type:  defect   |     Status:  new
 Priority:  normal   |  Milestone:  4.11.1
Component:  General  |    Version:  4.10
 Severity:  normal   |   Keywords:
---------------------+--------------------
 rtems/c/src/lib/libbsp/arm/atsam/network/if_atsam.c:409]: (style)
 Redundant condition: If 'phy <= 0', the comparison 'phy <= 31' is always
 true.

 Source code is

     if ((phy <= 0) && (phy <= 31)) {
         /*
          * invalid phy number
          */

 Maybe better code

     if ((phy <= 0) || (phy >= 31)) {
         /*
          * invalid phy number
          */

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


More information about the bugs mailing list