Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1583890 > unrolled thread

[PATCH] RDMA/qedr: Fix some error handling

Started byChristophe JAILLET <christophe.jaillet@wanadoo.fr>
First post2017-02-18 12:50 +0100
Last post2017-02-19 15:00 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] RDMA/qedr: Fix some error handling Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-02-18 12:50 +0100
    RE: [PATCH] RDMA/qedr: Fix some error handling "Amrani, Ram" <Ram.Amrani@cavium.com> - 2017-02-19 12:50 +0100
    Re: [PATCH] RDMA/qedr: Fix some error handling Doug Ledford <dledford@redhat.com> - 2017-02-19 15:00 +0100

#1583890 — [PATCH] RDMA/qedr: Fix some error handling

FromChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Date2017-02-18 12:50 +0100
Subject[PATCH] RDMA/qedr: Fix some error handling
Message-ID<tcbGx-1lW-9@gated-at.bofh.it>
'qedr_alloc_pbl_tbl()' can not return NULL.

In qedr_init_user_queue():
 - simplify the test for the return value, no need to test for NULL
 - propagate the error pointer if needed, otherwise 0 (success) is returned.
   This is spurious.

In init_mr_info():
 - test the return value with IS_ERR
 - propagate the error pointer if needed instead of an exlictit -ENOMEM.
   This is a no-op as the only error pointer that we can have here is
   already -ENOMEM

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/infiniband/hw/qedr/verbs.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
index ef83a3f322d6..0c51657af151 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -771,8 +771,10 @@ static inline int qedr_init_user_queue(struct ib_ucontext *ib_ctx,
 		goto err0;
 
 	q->pbl_tbl = qedr_alloc_pbl_tbl(dev, &q->pbl_info, GFP_KERNEL);
-	if (IS_ERR_OR_NULL(q->pbl_tbl))
+	if (IS_ERR(q->pbl_tbl)) {
+		rc = PTR_ERR(q->pbl_tbl);
 		goto err0;
+	}
 
 	qedr_populate_pbls(dev, q->umem, q->pbl_tbl, &q->pbl_info);
 
@@ -2105,8 +2107,8 @@ static int init_mr_info(struct qedr_dev *dev, struct mr_info *info,
 		goto done;
 
 	info->pbl_table = qedr_alloc_pbl_tbl(dev, &info->pbl_info, GFP_KERNEL);
-	if (!info->pbl_table) {
-		rc = -ENOMEM;
+	if (IS_ERR(info->pbl_table)) {
+		rc = PTR_ERR(info->pbl_table);
 		goto done;
 	}
 
@@ -2117,7 +2119,7 @@ static int init_mr_info(struct qedr_dev *dev, struct mr_info *info,
 	 * list and allocating another one
 	 */
 	tmp = qedr_alloc_pbl_tbl(dev, &info->pbl_info, GFP_KERNEL);
-	if (!tmp) {
+	if (IS_ERR(tmp)) {
 		DP_DEBUG(dev, QEDR_MSG_MR, "Extra PBL is not allocated\n");
 		goto done;
 	}
-- 
2.9.3

[toc] | [next] | [standalone]


#1584117

From"Amrani, Ram" <Ram.Amrani@cavium.com>
Date2017-02-19 12:50 +0100
Message-ID<tcya6-6Sq-15@gated-at.bofh.it>
In reply to#1583890
> 'qedr_alloc_pbl_tbl()' can not return NULL.
> 
> In qedr_init_user_queue():
>  - simplify the test for the return value, no need to test for NULL
>  - propagate the error pointer if needed, otherwise 0 (success) is returned.
>    This is spurious.
> 
> In init_mr_info():
>  - test the return value with IS_ERR
>  - propagate the error pointer if needed instead of an exlictit -ENOMEM.
>    This is a no-op as the only error pointer that we can have here is
>    already -ENOMEM
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/infiniband/hw/qedr/verbs.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
> index ef83a3f322d6..0c51657af151 100644
> --- a/drivers/infiniband/hw/qedr/verbs.c
> +++ b/drivers/infiniband/hw/qedr/verbs.c
> @@ -771,8 +771,10 @@ static inline int qedr_init_user_queue(struct ib_ucontext *ib_ctx,
>  		goto err0;
> 
>  	q->pbl_tbl = qedr_alloc_pbl_tbl(dev, &q->pbl_info, GFP_KERNEL);
> -	if (IS_ERR_OR_NULL(q->pbl_tbl))
> +	if (IS_ERR(q->pbl_tbl)) {
> +		rc = PTR_ERR(q->pbl_tbl);
>  		goto err0;
> +	}
> 
>  	qedr_populate_pbls(dev, q->umem, q->pbl_tbl, &q->pbl_info);
> 
> @@ -2105,8 +2107,8 @@ static int init_mr_info(struct qedr_dev *dev, struct mr_info *info,
>  		goto done;
> 
>  	info->pbl_table = qedr_alloc_pbl_tbl(dev, &info->pbl_info, GFP_KERNEL);
> -	if (!info->pbl_table) {
> -		rc = -ENOMEM;
> +	if (IS_ERR(info->pbl_table)) {
> +		rc = PTR_ERR(info->pbl_table);
>  		goto done;
>  	}
> 
> @@ -2117,7 +2119,7 @@ static int init_mr_info(struct qedr_dev *dev, struct mr_info *info,
>  	 * list and allocating another one
>  	 */
>  	tmp = qedr_alloc_pbl_tbl(dev, &info->pbl_info, GFP_KERNEL);
> -	if (!tmp) {
> +	if (IS_ERR(tmp)) {
>  		DP_DEBUG(dev, QEDR_MSG_MR, "Extra PBL is not allocated\n");
>  		goto done;
>  	}
> --
> 2.9.3


Acked-by: Ram Amrani <Ram.Amrani@cavium.com>

Merci

[toc] | [prev] | [next] | [standalone]


#1584145

FromDoug Ledford <dledford@redhat.com>
Date2017-02-19 15:00 +0100
Message-ID<tcAbT-83c-5@gated-at.bofh.it>
In reply to#1583890

[Multipart message — attachments visible in raw view] — view raw

On Sat, 2017-02-18 at 12:28 +0100, Christophe JAILLET wrote:
> 'qedr_alloc_pbl_tbl()' can not return NULL.
> 
> In qedr_init_user_queue():
>  - simplify the test for the return value, no need to test for NULL
>  - propagate the error pointer if needed, otherwise 0 (success) is
> returned.
>    This is spurious.
> 
> In init_mr_info():
>  - test the return value with IS_ERR
>  - propagate the error pointer if needed instead of an exlictit
> -ENOMEM.
>    This is a no-op as the only error pointer that we can have here is
>    already -ENOMEM
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Thanks, applied.

-- 
Doug Ledford <dledford@redhat.com>
    GPG KeyID: B826A3330E572FDD
   
Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web