You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/08/04 03:53:31 UTC

[incubator-nuttx] branch master updated (16cd363 -> 0b90ad3)

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from 16cd363  arch: lc823450: Replace license header with Apache License 2.0
     new 4f7745a  net/tcp/tcp_timer.c: Remove redundant assignments
     new 59ba52a  drivers/usbhost/hid_parser.c: Fix out of range array accesses
     new 123a31e  drivers/usbhost/hid_parser.c: nxstyle fixes
     new 0b90ad3  arch/sim/src/sim/up_exit.c: Appease a clang-check warning

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 arch/sim/src/sim/up_exit.c   |  4 +--
 drivers/usbhost/hid_parser.c | 59 +++++++++++++++++++++++++++-----------------
 net/tcp/tcp_timer.c          |  6 ++---
 3 files changed, 41 insertions(+), 28 deletions(-)


[incubator-nuttx] 04/04: arch/sim/src/sim/up_exit.c: Appease a clang-check warning

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 0b90ad3dd4e549cfca3416b223974a08fb03fa1c
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Tue Aug 4 10:37:35 2020 +0900

    arch/sim/src/sim/up_exit.c: Appease a clang-check warning
    
    clang-check complained like the following.
    While this is not a real bug, it's easy to appease.
    
    sim/up_exit.c:68:21: warning: Value stored to 'tcb' during its initialization is never read
      FAR struct tcb_s *tcb = this_task();
                        ^~~   ~~~~~~~~~~~
    1 warning generated.
---
 arch/sim/src/sim/up_exit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/sim/src/sim/up_exit.c b/arch/sim/src/sim/up_exit.c
index fada99a..4241e60 100644
--- a/arch/sim/src/sim/up_exit.c
+++ b/arch/sim/src/sim/up_exit.c
@@ -65,9 +65,9 @@
 
 void up_exit(int status)
 {
-  FAR struct tcb_s *tcb = this_task();
+  FAR struct tcb_s *tcb;
 
-  sinfo("TCB=%p exiting\n", tcb);
+  sinfo("TCB=%p exiting\n", this_task());
 
   /* Destroy the task at the head of the ready to run list. */
 


[incubator-nuttx] 03/04: drivers/usbhost/hid_parser.c: nxstyle fixes

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 123a31e3a2d8849d7da6a6c1ef1fcd5fd54de551
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Tue Aug 4 10:24:09 2020 +0900

    drivers/usbhost/hid_parser.c: nxstyle fixes
---
 drivers/usbhost/hid_parser.c | 51 +++++++++++++++++++++++++++-----------------
 1 file changed, 32 insertions(+), 19 deletions(-)

diff --git a/drivers/usbhost/hid_parser.c b/drivers/usbhost/hid_parser.c
index 00ee05e..fa41603 100644
--- a/drivers/usbhost/hid_parser.c
+++ b/drivers/usbhost/hid_parser.c
@@ -71,14 +71,16 @@ struct hid_state_s
  *    report   Buffer containing the device's HID report table.
  *    rptlen   Size in bytes of the HID report table.
  *    filter   Callback function to decide if an item should be retained
- *    rptinfo  Pointer to a struct hid_rptinfo_s instance for the parser output.
+ *    rptinfo  Pointer to a struct hid_rptinfo_s instance for the parser
+ *             output.
  *
  * Returned Value:
  *  Zero on success, otherwise a negated errno value.
  ****************************************************************************/
 
 int hid_parsereport(FAR const uint8_t *report, int rptlen,
-                    hid_rptfilter_t filter, FAR struct hid_rptinfo_s *rptinfo)
+                    hid_rptfilter_t filter,
+                    FAR struct hid_rptinfo_s *rptinfo)
 {
   struct hid_state_s           state[CONFIG_HID_STATEDEPTH];
   struct hid_state_s          *currstate = &state[0];
@@ -86,7 +88,12 @@ int hid_parsereport(FAR const uint8_t *report, int rptlen,
   struct hid_rptsizeinfo_s    *rptidinfo = &rptinfo->rptsize[0];
   uint16_t                     usage[CONFIG_HID_USAGEDEPTH];
   uint8_t                      nusage = 0;
-  struct hid_range_s           usage_range = { 0, 0 };
+  struct hid_range_s           usage_range =
+    {
+      0,
+      0
+    };
+
   int                          i;
 
   DEBUGASSERT(report && filter && rptinfo);
@@ -250,13 +257,15 @@ int hid_parsereport(FAR const uint8_t *report, int rptlen,
             }
           else
             {
-              struct hid_collectionpath_s *ParentCollectionPath = collectionpath;
+              struct hid_collectionpath_s *parent_collection_path =
+                  collectionpath;
 
               collectionpath = &rptinfo->collectionpaths[1];
 
               while (collectionpath->parent != NULL)
                 {
-                  if (collectionpath == &rptinfo->collectionpaths[CONFIG_HID_MAXCOLLECTIONS - 1])
+                  if (collectionpath == &rptinfo->collectionpaths[
+                                        CONFIG_HID_MAXCOLLECTIONS - 1])
                     {
                       return -EINVAL;
                     }
@@ -264,7 +273,7 @@ int hid_parsereport(FAR const uint8_t *report, int rptlen,
                   collectionpath++;
                 }
 
-              collectionpath->parent = ParentCollectionPath;
+              collectionpath->parent = parent_collection_path;
             }
 
           collectionpath->type       = data;
@@ -320,6 +329,7 @@ int hid_parsereport(FAR const uint8_t *report, int rptlen,
                       {
                         usage[i - 1] = usage[i];
                       }
+
                     nusage--;
                   }
                 else if (usage_range.min <= usage_range.max)
@@ -341,7 +351,7 @@ int hid_parsereport(FAR const uint8_t *report, int rptlen,
                     newitem.type = HID_REPORT_ITEM_FEATURE;
                   }
 
-                newitem.bitoffset              = rptidinfo->size[newitem.type];
+                newitem.bitoffset = rptidinfo->size[newitem.type];
                 rptidinfo->size[newitem.type] += currstate->attrib.bitsize;
 
                 /* Accumulate the maximum report size */
@@ -389,8 +399,8 @@ int hid_parsereport(FAR const uint8_t *report, int rptlen,
  *
  * Description:
  *   Extracts the given report item's value out of the given HID report and
- *   places it into the value member of the report item's struct hid_rptitem_s
- *   structure.
+ *   places it into the value member of the report item's struct
+ *   hid_rptitem_s structure.
  *
  *   When called on a report with an item that exists in that report, this
  *   copies the report item's Value to it's previous element for easy
@@ -401,8 +411,8 @@ int hid_parsereport(FAR const uint8_t *report, int rptlen,
  * Input Parameters:
  *   report  Buffer containing an IN or FEATURE report from an attached
  *               device.
- *   item        Pointer to the report item of interest in a struct hid_rptinfo_s
- *               item array.
+ *   item        Pointer to the report item of interest in a struct
+ *               hid_rptinfo_s item array.
  *
  * Returned Value:
  *   Zero on success, otherwise a negated errno value.
@@ -447,10 +457,11 @@ int hid_getitem(FAR const uint8_t *report, FAR struct hid_rptitem_s *item)
  *
  * Description:
  *   Retrieves the given report item's value out of the Value member of the
- *   report item's struct hid_rptitem_s structure and places it into the correct
- *   position in the HID report buffer. The report buffer is assumed to have
- *   the appropriate bits cleared before calling this function (i.e., the
- *   buffer should be explicitly cleared before report values are added).
+ *   report item's struct hid_rptitem_s structure and places it into the
+ *   correct position in the HID report buffer. The report buffer is assumed
+ *   to have the appropriate bits cleared before calling this function
+ *   (i.e., the buffer should be explicitly cleared before report values are
+ *   added).
  *
  *   When called, this copies the report item's Value element to it's
  *   previous element for easy checking to see if an item's value has
@@ -501,16 +512,18 @@ void hid_putitem(FAR uint8_t *report, struct hid_rptitem_s *item)
  *   Retrieves the size of a given HID report in bytes from it's Report ID.
  *
  * Input Parameters:
- *  rptinfo Pointer to a struct hid_rptinfo_s instance containing the parser output.
+ *  rptinfo Pointer to a struct hid_rptinfo_s instance containing the parser
+ *          output.
  *  id      Report ID of the report whose size is to be retrieved.
- *  rpttype Type of the report whose size is to be determined, a valued from the
- *          HID_ReportItemTypes_t enum.
+ *  rpttype Type of the report whose size is to be determined, a valued from
+ *          the HID_ReportItemTypes_t enum.
  *
  *  Size of the report in bytes, or 0 if the report does not exist.
  *
  ****************************************************************************/
 
-size_t hid_reportsize(FAR struct hid_rptinfo_s *rptinfo, uint8_t id, uint8_t rpttype)
+size_t hid_reportsize(FAR struct hid_rptinfo_s *rptinfo, uint8_t id,
+                      uint8_t rpttype)
 {
   int i;
   for (i = 0; i < CONFIG_HID_MAXIDS; i++)


[incubator-nuttx] 01/04: net/tcp/tcp_timer.c: Remove redundant assignments

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 4f7745ae1c47958ab4273eb9d273c5c8f3067281
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Tue Aug 4 10:09:33 2020 +0900

    net/tcp/tcp_timer.c: Remove redundant assignments
    
    Found by clang-check:
    
    tcp/tcp_timer.c:185:15: warning: Value stored to 'result' is never read
                  result = tcp_callback(dev, conn, TCP_TIMEDOUT);
                  ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    tcp/tcp_timer.c:264:23: warning: Value stored to 'result' is never read
                          result = tcp_callback(dev, listener, TCP_TIMEDOUT);
                          ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    tcp/tcp_timer.c:300:19: warning: Value stored to 'result' is never read
                      result = tcp_callback(dev, conn, TCP_TIMEDOUT);
                      ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3 warnings generated.
---
 net/tcp/tcp_timer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/tcp/tcp_timer.c b/net/tcp/tcp_timer.c
index d78d6ea..56e988d 100644
--- a/net/tcp/tcp_timer.c
+++ b/net/tcp/tcp_timer.c
@@ -182,7 +182,7 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
 
               /* Notify upper layers about the timeout */
 
-              result = tcp_callback(dev, conn, TCP_TIMEDOUT);
+              tcp_callback(dev, conn, TCP_TIMEDOUT);
 
               ninfo("TCP state: TCP_CLOSED\n");
             }
@@ -261,7 +261,7 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
                        * connection has timed out.
                        */
 
-                      result = tcp_callback(dev, listener, TCP_TIMEDOUT);
+                      tcp_callback(dev, listener, TCP_TIMEDOUT);
                     }
 
                   /* We also send a reset packet to the remote host. */
@@ -297,7 +297,7 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
                    * timed out.
                    */
 
-                  result = tcp_callback(dev, conn, TCP_TIMEDOUT);
+                  tcp_callback(dev, conn, TCP_TIMEDOUT);
 
                   /* We also send a reset packet to the remote host. */
 


[incubator-nuttx] 02/04: drivers/usbhost/hid_parser.c: Fix out of range array accesses

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 59ba52aee8fd21442fa59ff4a04a30e6ff8d0c80
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Tue Aug 4 10:17:41 2020 +0900

    drivers/usbhost/hid_parser.c: Fix out of range array accesses
    
    Found by clang-check:
    
    usbhost/hid_parser.c:278:26: warning: Assigned value is garbage or undefined
                    usage[i] = usage[i + 1];
                             ^ ~~~~~~~~~~~~
    usbhost/hid_parser.c:321:34: warning: Assigned value is garbage or undefined
                            usage[i] = usage[i + 1];
                                     ^ ~~~~~~~~~~~~
    2 warnings generated.
---
 drivers/usbhost/hid_parser.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usbhost/hid_parser.c b/drivers/usbhost/hid_parser.c
index e87df56..00ee05e 100644
--- a/drivers/usbhost/hid_parser.c
+++ b/drivers/usbhost/hid_parser.c
@@ -274,8 +274,8 @@ int hid_parsereport(FAR const uint8_t *report, int rptlen,
             {
               collectionpath->usage.usage = usage[0];
 
-              for (i = 0; i < nusage; i++)
-                usage[i] = usage[i + 1];
+              for (i = 1; i < nusage; i++)
+                usage[i - 1] = usage[i];
 
               nusage--;
             }
@@ -316,9 +316,9 @@ int hid_parsereport(FAR const uint8_t *report, int rptlen,
                   {
                     newitem.attrib.usage.usage = usage[0];
 
-                    for (i = 0; i < nusage; i++)
+                    for (i = 1; i < nusage; i++)
                       {
-                        usage[i] = usage[i + 1];
+                        usage[i - 1] = usage[i];
                       }
                     nusage--;
                   }