net: thunderx: set xdp_prog to NULL if bpf_prog_add fails
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Wed, 21 Nov 2018 15:32:10 +0000 (16:32 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Dec 2018 18:41:16 +0000 (19:41 +0100)
commit44e4f3644934b65c91bc05245a9447dde2c7af40
treebb181bdaa574658ca4eee66631ab013178341240
parent3a8a411c927716fad4004a6953a5b2cf988eb2df
net: thunderx: set xdp_prog to NULL if bpf_prog_add fails

[ Upstream commit 6d0f60b0f8588fd4380ea5df9601e12fddd55ce2 ]

Set xdp_prog pointer to NULL if bpf_prog_add fails since that routine
reports the error code instead of NULL in case of failure and xdp_prog
pointer value is used in the driver to verify if XDP is currently
enabled.
Moreover report the error code to userspace if nicvf_xdp_setup fails

Fixes: 05c773f52b96 ("net: thunderx: Add basic XDP support")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/cavium/thunder/nicvf_main.c