* [patch 2/2] IB/hns: Fix some error handling in hns_roce_v1_query_qp()
@ 2016-10-14 7:34 Dan Carpenter
2016-10-14 8:31 ` oulijun
2016-10-24 12:29 ` oulijun
0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2016-10-14 7:34 UTC (permalink / raw)
To: Lijun Ou
Cc: Wei Hu(Xavier), Doug Ledford, Sean Hefty, Hal Rosenstock,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
to_ib_qp_state() returns IB_QPS_ERR (6) on error, it doesn't return -1.
Fixes: 9a4435375cd1 ('IB/hns: Add driver files for hns RoCE driver')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
index 58b150e..280abac 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
@@ -2544,7 +2544,7 @@ int hns_roce_v1_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
QP_CONTEXT_QPC_BYTES_144_QP_STATE_M,
QP_CONTEXT_QPC_BYTES_144_QP_STATE_S);
tmp_qp_state = (int)to_ib_qp_state((enum hns_roce_qp_state)state);
- if (tmp_qp_state = -1) {
+ if (tmp_qp_state = IB_QPS_ERR) {
dev_err(dev, "to_ib_qp_state error\n");
ret = -EINVAL;
goto out;
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [patch 2/2] IB/hns: Fix some error handling in hns_roce_v1_query_qp()
2016-10-14 7:34 [patch 2/2] IB/hns: Fix some error handling in hns_roce_v1_query_qp() Dan Carpenter
@ 2016-10-14 8:31 ` oulijun
2016-10-24 12:29 ` oulijun
1 sibling, 0 replies; 4+ messages in thread
From: oulijun @ 2016-10-14 8:31 UTC (permalink / raw)
To: Dan Carpenter
Cc: Wei Hu(Xavier), Doug Ledford, Sean Hefty, Hal Rosenstock,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
在 2016/10/14 15:34, Dan Carpenter 写道:
> to_ib_qp_state() returns IB_QPS_ERR (6) on error, it doesn't return -1.
>
> Fixes: 9a4435375cd1 ('IB/hns: Add driver files for hns RoCE driver')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
> index 58b150e..280abac 100644
> --- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
> +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
> @@ -2544,7 +2544,7 @@ int hns_roce_v1_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
> QP_CONTEXT_QPC_BYTES_144_QP_STATE_M,
> QP_CONTEXT_QPC_BYTES_144_QP_STATE_S);
> tmp_qp_state = (int)to_ib_qp_state((enum hns_roce_qp_state)state);
> - if (tmp_qp_state = -1) {
> + if (tmp_qp_state = IB_QPS_ERR) {
> dev_err(dev, "to_ib_qp_state error\n");
> ret = -EINVAL;
> goto out;
>
> .
>
Hi, Dan Carpenter
This is good for me.
Thanks
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [patch 2/2] IB/hns: Fix some error handling in hns_roce_v1_query_qp()
2016-10-14 7:34 [patch 2/2] IB/hns: Fix some error handling in hns_roce_v1_query_qp() Dan Carpenter
2016-10-14 8:31 ` oulijun
@ 2016-10-24 12:29 ` oulijun
[not found] ` <580DFEB0.20100-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
1 sibling, 1 reply; 4+ messages in thread
From: oulijun @ 2016-10-24 12:29 UTC (permalink / raw)
To: Dan Carpenter
Cc: Wei Hu(Xavier), Doug Ledford, Sean Hefty, Hal Rosenstock,
linux-rdma, kernel-janitors
在 2016/10/14 15:34, Dan Carpenter 写道:
> to_ib_qp_state() returns IB_QPS_ERR (6) on error, it doesn't return -1.
>
> Fixes: 9a4435375cd1 ('IB/hns: Add driver files for hns RoCE driver')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
> index 58b150e..280abac 100644
> --- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
> +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
> @@ -2544,7 +2544,7 @@ int hns_roce_v1_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
> QP_CONTEXT_QPC_BYTES_144_QP_STATE_M,
> QP_CONTEXT_QPC_BYTES_144_QP_STATE_S);
> tmp_qp_state = (int)to_ib_qp_state((enum hns_roce_qp_state)state);
> - if (tmp_qp_state = -1) {
> + if (tmp_qp_state = IB_QPS_ERR) {
> dev_err(dev, "to_ib_qp_state error\n");
> ret = -EINVAL;
> goto out;
>
> .
>
Hi, Dan Carpenter
After checking your modification, I think that it maybe fix this:
static enum ib_qp_state to_ib_qp_state(enum hns_roce_qp_state state)
{
switch (state) {
case HNS_ROCE_QP_STATE_RST:
return IB_QPS_RESET;
case HNS_ROCE_QP_STATE_INIT:
return IB_QPS_INIT;
case HNS_ROCE_QP_STATE_RTR:
return IB_QPS_RTR;
case HNS_ROCE_QP_STATE_RTS:
return IB_QPS_RTS;
case HNS_ROCE_QP_STATE_SQD:
return IB_QPS_SQD;
case HNS_ROCE_QP_STATE_ERR:
return IB_QPS_ERR;
default:
return -1;
}
}
because the IB_QPS_ERR is legal state, but the tmp_qp_state should return a illegal state when
the the to_ib_qp_state executed the default branch.
thanks
Lijun Ou
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-10-24 13:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-14 7:34 [patch 2/2] IB/hns: Fix some error handling in hns_roce_v1_query_qp() Dan Carpenter
2016-10-14 8:31 ` oulijun
2016-10-24 12:29 ` oulijun
[not found] ` <580DFEB0.20100-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2016-10-24 13:43 ` Dan Carpenter
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).