nfp: return nfp_rtsym_read_le() errors correctly
authorJakub Kicinski <jakub.kicinski@netronome.com>
Sun, 19 Feb 2017 19:58:13 +0000 (11:58 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 20 Feb 2017 16:18:49 +0000 (11:18 -0500)
nfp_rtsym_read_le() has an out parameter for error codes.
We have to use that instead of returning errors directly.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_rtsym.c

index c659b1d999bea6562481db68e8ce3eb4344ee7a1..0e3870ecfb8cd69d99fafc03a6a20748dc29de79 100644 (file)
@@ -269,8 +269,10 @@ u64 nfp_rtsym_read_le(struct nfp_cpp *cpp, const char *name, int *error)
        int err;
 
        sym = nfp_rtsym_lookup(cpp, name);
-       if (!sym)
-               return -ENOENT;
+       if (!sym) {
+               err = -ENOENT;
+               goto exit;
+       }
 
        id = NFP_CPP_ISLAND_ID(sym->target, NFP_CPP_ACTION_RW, 0, sym->domain);
 
@@ -294,7 +296,7 @@ u64 nfp_rtsym_read_le(struct nfp_cpp *cpp, const char *name, int *error)
                err = 0;
        else if (err >= 0)
                err = -EIO;
-
+exit:
        if (error)
                *error = err;