On Wed, Oct 16, 2024 at 06:53:10PM +0800, Yue Haibing wrote:
> Return NULL instead of passing to ERR_PTR while res is IGC_XDP_PASS,
> which is zero, this fix smatch warnings:
> drivers/net/ethernet/intel/igc/igc_main.c:2533
>  igc_xdp_run_prog() warn: passing zero to 'ERR_PTR'
> 
> Fixes: 26575105d6ed ("igc: Add initial XDP support")
> Signed-off-by: Yue Haibing <[email protected]>
> ---
>  drivers/net/ethernet/intel/igc/igc_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/igc/igc_main.c 
> b/drivers/net/ethernet/intel/igc/igc_main.c
> index 6e70bca15db1..c3d6e20c0be0 100644
> --- a/drivers/net/ethernet/intel/igc/igc_main.c
> +++ b/drivers/net/ethernet/intel/igc/igc_main.c
> @@ -2530,7 +2530,7 @@ static struct sk_buff *igc_xdp_run_prog(struct 
> igc_adapter *adapter,
>       res = __igc_xdp_run_prog(adapter, prog, xdp);
>  
>  out:
> -     return ERR_PTR(-res);
> +     return res ? ERR_PTR(-res) : NULL;

I think this is what PTR_ERR_OR_ZERO() is for.

Reply via email to