10665 fcoe: NULL pointer errors

Review Request #1638 — Created April 2, 2019 and submitted

tsoome
illumos-gate
10665
dd987db...
general
../../common/io/fcoe/fcoe_fc.c: In function 'fcoe_tx_frame':
../../common/io/fcoe/fcoe_fc.c:211:17: error: comparison between pointer and integer [-Werror]
  if (ret_cookie != NULL) {
                 ^~
cc1: all warnings being treated as errors


  • 0
  • 0
  • 0
  • 1
  • 1
Description From Last Updated
rm
  1. 
      
  2. usr/src/uts/common/io/fcoe/fcoe_fc.c (Diff revision 1)
     
     
    Since the mac_tx_cookie_t is a uintptr_t, should we use 0 instead of casting? Though the cast does make it more explicit.
    1. There is this thing.... http://src.illumos.org/source/xref/illumos-gate/usr/src/uts/common/io/mac/mac_client.c#3434 Of course the NULL in mac_tx() is error too (I have it in my queue), but there we go - if the error case is denoted by NULL (0), then the cast above is ok. And we have taken this path before anyhow:)

    2. OK, seems reasonable.

  3. 
      
rm
  1. Ship It!
  2. 
      
domag02
  1. Ship It!
  2. 
      
gwr
  1. 
      
  2. usr/src/uts/common/io/fcoe/fcoe_fc.c (Diff revision 1)
     
     

    Not a big deal, but: Why not just

        if (ret_cookie != 0) ...
    

    I prefer not littering code with casts when they're not necessary.

    1. I was asked to use casts to specific types - mac_tx_cookie_t in this case. Yes it is 0 nevertheless.

  3. 
      
tsoome
Review request changed

Status: Closed (submitted)

Loading...