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:31:59 +0000 (19:31 +0100)
commit2f6cfb8e9f5c69657ded5c5bea9dab1c727de66a
tree5a2dac4466c88eaac7e4ebc6286bc78118fb9d9a
parent535b494a4fa570895dc49f5b7e6ab05f4a713a82
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