All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] RDMA/irdma: Fix missing error code in irdma_modify_qp_roce()
@ 2021-07-26  7:45 Jiapeng Chong
  2021-07-26  9:14 ` Leon Romanovsky
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2021-07-26  7:45 UTC (permalink / raw)
  To: mustafa.ismail
  Cc: shiraz.saleem, dledford, jgg, linux-rdma, linux-kernel, Jiapeng Chong

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

Eliminate the follow smatch warning:

drivers/infiniband/hw/irdma/verbs.c:1344 irdma_modify_qp_roce() warn:
missing error code 'ret'.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Fixes: b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs")
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
Changes in v2:
  -For the follow advice: https://lore.kernel.org/patchwork/patch/1466463/

 drivers/infiniband/hw/irdma/verbs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
index 717147e..721cb0c 100644
--- a/drivers/infiniband/hw/irdma/verbs.c
+++ b/drivers/infiniband/hw/irdma/verbs.c
@@ -1340,8 +1340,10 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 			}
 			break;
 		case IB_QPS_SQD:
-			if (iwqp->iwarp_state == IRDMA_QP_STATE_SQD)
+			if (iwqp->iwarp_state == IRDMA_QP_STATE_SQD) {
+				ret = -EINVAL;
 				goto exit;
+			}
 
 			if (iwqp->iwarp_state != IRDMA_QP_STATE_RTS) {
 				ret = -EINVAL;
-- 
1.8.3.1


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

* Re: [PATCH v2] RDMA/irdma: Fix missing error code in irdma_modify_qp_roce()
  2021-07-26  7:45 [PATCH v2] RDMA/irdma: Fix missing error code in irdma_modify_qp_roce() Jiapeng Chong
@ 2021-07-26  9:14 ` Leon Romanovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2021-07-26  9:14 UTC (permalink / raw)
  To: Jiapeng Chong
  Cc: mustafa.ismail, shiraz.saleem, dledford, jgg, linux-rdma, linux-kernel

On Mon, Jul 26, 2021 at 03:45:10PM +0800, Jiapeng Chong wrote:
> The error code is missing in this code scenario, add the error code
> '-EINVAL' to the return value 'ret'.
> 
> Eliminate the follow smatch warning:
> 
> drivers/infiniband/hw/irdma/verbs.c:1344 irdma_modify_qp_roce() warn:
> missing error code 'ret'.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Fixes: b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs")
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
> Changes in v2:
>   -For the follow advice: https://lore.kernel.org/patchwork/patch/1466463/
> 
>  drivers/infiniband/hw/irdma/verbs.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
> index 717147e..721cb0c 100644
> --- a/drivers/infiniband/hw/irdma/verbs.c
> +++ b/drivers/infiniband/hw/irdma/verbs.c
> @@ -1340,8 +1340,10 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr,
>  			}
>  			break;
>  		case IB_QPS_SQD:
> -			if (iwqp->iwarp_state == IRDMA_QP_STATE_SQD)
> +			if (iwqp->iwarp_state == IRDMA_QP_STATE_SQD) {
> +				ret = -EINVAL;
>  				goto exit;

It is wrong, SQD-to-SQD is a valid transition and ret should be 0, which
is already set at the beginning of that function.

Thanks

> +			}
>  
>  			if (iwqp->iwarp_state != IRDMA_QP_STATE_RTS) {
>  				ret = -EINVAL;
> -- 
> 1.8.3.1
> 

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

end of thread, other threads:[~2021-07-26  9:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26  7:45 [PATCH v2] RDMA/irdma: Fix missing error code in irdma_modify_qp_roce() Jiapeng Chong
2021-07-26  9:14 ` Leon Romanovsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.