bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sfc: Fix missing error code in efx_reset_up()
@ 2022-01-13 16:13 Jiapeng Chong
  2022-01-14  9:41 ` Martin Habets
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2022-01-13 16:13 UTC (permalink / raw)
  To: ecree.xilinx
  Cc: habetsm.xilinx, davem, kuba, ast, daniel, hawk, john.fastabend,
	netdev, linux-kernel, bpf, Jiapeng Chong, Abaci Robot

The error code is missing in this code scenario, add the error code
'-EINVAL' to the return value 'rc'.

Eliminate the follow smatch warning:

drivers/net/ethernet/sfc/efx_common.c:758 efx_reset_up() warn: missing
error code 'rc'.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 drivers/net/ethernet/sfc/efx_common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/sfc/efx_common.c b/drivers/net/ethernet/sfc/efx_common.c
index af37c990217e..bdfcda8bb5d0 100644
--- a/drivers/net/ethernet/sfc/efx_common.c
+++ b/drivers/net/ethernet/sfc/efx_common.c
@@ -754,8 +754,10 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok)
 		goto fail;
 	}
 
-	if (!ok)
+	if (!ok) {
+		rc = -EINVAL;
 		goto fail;
+	}
 
 	if (efx->port_initialized && method != RESET_TYPE_INVISIBLE &&
 	    method != RESET_TYPE_DATAPATH) {
-- 
2.20.1.7.g153144c


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sfc: Fix missing error code in efx_reset_up()
  2022-01-13 16:13 [PATCH] sfc: Fix missing error code in efx_reset_up() Jiapeng Chong
@ 2022-01-14  9:41 ` Martin Habets
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Habets @ 2022-01-14  9:41 UTC (permalink / raw)
  To: Jiapeng Chong
  Cc: ecree.xilinx, habetsm.xilinx, davem, kuba, ast, daniel, hawk,
	john.fastabend, netdev, linux-kernel, bpf, Abaci Robot

On Fri, Jan 14, 2022 at 12:13:15AM +0800, Jiapeng Chong wrote:
> The error code is missing in this code scenario, add the error code
> '-EINVAL' to the return value 'rc'.
> 
> Eliminate the follow smatch warning:
> 
> drivers/net/ethernet/sfc/efx_common.c:758 efx_reset_up() warn: missing
> error code 'rc'.

The warning is not correct. We want to return an rc of 0 in this case, and
that is what rc is already set to given the earlier code.

Martin

> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  drivers/net/ethernet/sfc/efx_common.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/sfc/efx_common.c b/drivers/net/ethernet/sfc/efx_common.c
> index af37c990217e..bdfcda8bb5d0 100644
> --- a/drivers/net/ethernet/sfc/efx_common.c
> +++ b/drivers/net/ethernet/sfc/efx_common.c
> @@ -754,8 +754,10 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok)
>  		goto fail;
>  	}
>  
> -	if (!ok)
> +	if (!ok) {
> +		rc = -EINVAL;
>  		goto fail;
> +	}
>  
>  	if (efx->port_initialized && method != RESET_TYPE_INVISIBLE &&
>  	    method != RESET_TYPE_DATAPATH) {
> -- 
> 2.20.1.7.g153144c

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-14  9:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13 16:13 [PATCH] sfc: Fix missing error code in efx_reset_up() Jiapeng Chong
2022-01-14  9:41 ` Martin Habets

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).