You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2020/01/27 19:42:19 UTC

[GitHub] [mynewt-newt] ccollins476ad opened a new pull request #373: Fix some issue reported by Coverity

ccollins476ad opened a new pull request #373: Fix some issue reported by Coverity
URL: https://github.com/apache/mynewt-newt/pull/373
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-newt] ccollins476ad commented on a change in pull request #373: Fix some issues reported by Coverity

Posted by GitBox <gi...@apache.org>.
ccollins476ad commented on a change in pull request #373: Fix some issues reported by Coverity
URL: https://github.com/apache/mynewt-newt/pull/373#discussion_r371932356
 
 

 ##########
 File path: newt/toolchain/compiler.go
 ##########
 @@ -1374,7 +1373,7 @@ func (c *Compiler) CopySymbols(infile string, outfile string, sm *symbol.SymbolM
 	if err != nil {
 		return err
 	}
-	return err
+	return nil
 
 Review comment:
   @utzig You are right - there was no actual bug here.  Unfortunately I cannot post the actual Coverity scan results since they come from a private version of the analyzer, but the description of the issue is:
   > Identical code for different branches
   
   So even though there is no bug, I agree with Coverity that the code did not look right.  I think there are two ways to fix this:
   1. Remove the `if err != nil` entirely.  Keep the `return err`.
   2. Do what I did (change `return err` to `return nil`).
   
   I prefer option 2 because it is more "Go-like" and consistent with the rest of the code.  Also, I think it improves maintainability because it makes it easy to add more code before the `return nil`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-newt] ccollins476ad merged pull request #373: Fix some issues reported by Coverity

Posted by GitBox <gi...@apache.org>.
ccollins476ad merged pull request #373: Fix some issues reported by Coverity
URL: https://github.com/apache/mynewt-newt/pull/373
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-newt] ccollins476ad commented on a change in pull request #373: Fix some issues reported by Coverity

Posted by GitBox <gi...@apache.org>.
ccollins476ad commented on a change in pull request #373: Fix some issues reported by Coverity
URL: https://github.com/apache/mynewt-newt/pull/373#discussion_r371932356
 
 

 ##########
 File path: newt/toolchain/compiler.go
 ##########
 @@ -1374,7 +1373,7 @@ func (c *Compiler) CopySymbols(infile string, outfile string, sm *symbol.SymbolM
 	if err != nil {
 		return err
 	}
-	return err
+	return nil
 
 Review comment:
   @utzig You are right - there was no actual bug here.  Unfortunately I cannot post the actual Coverity scan results since they come from a private version of the analyzer, but the description of the issue is:
   > Identical code for different branches
   
   So even though there is no bug, I agree with Coverity that the code did not look right.  I think there are two ways to fix this:
   1. Remove the `if err != nil` entirely.  Keep the `return err`.
   2. Do what I did (change `return err` to `return nil`).
   
   I prefer option 2 because it is more "Go-like" consistent with the rest of the code.  Also, I think it improves maintainability because it makes it easy to add more code before the `return nil`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-newt] utzig commented on a change in pull request #373: Fix some issues reported by Coverity

Posted by GitBox <gi...@apache.org>.
utzig commented on a change in pull request #373: Fix some issues reported by Coverity
URL: https://github.com/apache/mynewt-newt/pull/373#discussion_r371786203
 
 

 ##########
 File path: newt/toolchain/compiler.go
 ##########
 @@ -1374,7 +1373,7 @@ func (c *Compiler) CopySymbols(infile string, outfile string, sm *symbol.SymbolM
 	if err != nil {
 		return err
 	}
-	return err
+	return nil
 
 Review comment:
   I don't understand this issue and the one above it, if `err` is being tested for non-`nil` value above could it be anything different than `nil` in the `return`? (Non related to the question, I guess the test above could be removed for this one). The other changes in this PR look good.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services