• Dan Carpenter's avatar
    Bluetooth: msft: __hci_cmd_sync() doesn't return NULL · 41c56aa9
    Dan Carpenter authored
    The __hci_cmd_sync() function doesn't return NULL.  Checking for NULL
    doesn't make the code safer, it just confuses people.
    
    When a function returns both error pointers and NULL then generally the
    NULL is a kind of success case.  For example, maybe we look up an item
    then errors mean we ran out of memory but NULL means the item is not
    found.  Or if we request a feature, then error pointers mean that there
    was an error but NULL means that the feature has been deliberately
    turned off.
    
    In this code it's different.  The NULL is handled as if there is a bug
    in __hci_cmd_sync() where it accidentally returns NULL instead of a
    proper error code.  This was done consistently until commit 9e14606d
    ("Bluetooth: msft: Extended monitor tracking by address filter") which
    deleted the work around for the potential future bug and treated NULL as
    success.
    
    Predicting potential future bugs is complicated, but we should just fix
    them instead of working around them.  Instead of debating whether NULL
    is failure or success, let's just say it's currently impossible and
    delete the dead code.
    Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
    Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
    41c56aa9
msft.c 30 KB