[PATCH v2 0/4] staging: dgnc: remove goto task from TODO list

Tobin C. Harding me at tobin.cc
Tue Mar 7 09:57:00 UTC 2017


TODO file contains task to verify and correct function return
sites. Need to check for and implement correct usage of goto's when
there is work to be done before returning. 

Patch series is broken up by file to ease review. Perhaps a single
patch would have been more appropriate. Changes to dgnc_mgmt are more
stylistic than all other changes. Perhaps if review ok's those
changes patch set could be rolled into one patch. Happy to do so if
deemed appropriate.

In order to make all return sites uniform the following format was
chosen

1. Use variable name 'rc' throughout.

2. No space after function call when checking return value

    rc = fn(foo);
    if (rc)
       return rc;

3. If multiple returns occur at start of function with same error
code, define and declare rc in single statement and return rc

      int rc = -ENOMEM;
      ...
      if (conditional)
         return rc;
      ...
      if (other-conditional)
         return rc;
      ...

v1 -> v2:
 - remove out of place white space change from patch 01 of series

Tobin C. Harding (4):
  staging: dgnc: audit goto's in dgnc_driver
  staging: dgnc: audit goto's in dgnc_mgmt
  staging: dgnc: audit goto's in dgnc_tty
  staging: dgnc: remove item from TODO list

 drivers/staging/dgnc/TODO          |   1 -
 drivers/staging/dgnc/dgnc_driver.c |  23 +---
 drivers/staging/dgnc/dgnc_mgmt.c   |  37 ++++---
 drivers/staging/dgnc/dgnc_tty.c    | 219 +++++++++++++++++++------------------
 4 files changed, 137 insertions(+), 143 deletions(-)

-- 
2.7.4



More information about the devel mailing list