diff mbox

nvmet/rdma: fix ptr_ret.cocci warnings

Message ID 20160614052541.GA19284@lkp-nex05 (mailing list archive)
State Not Applicable
Headers show

Commit Message

Fengguang Wu June 14, 2016, 5:25 a.m. UTC
drivers/nvme/target/rdma.c:1441:1-3: WARNING: PTR_ERR_OR_ZERO can be used


 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 rdma.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Nicholas A. Bellinger June 14, 2016, 6:57 a.m. UTC | #1
On Tue, 2016-06-14 at 13:25 +0800, kbuild test robot wrote:
> drivers/nvme/target/rdma.c:1441:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> 
> 
>  Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> 
> Generated by: scripts/coccinelle/api/ptr_ret.cocci
> 
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> ---
> 
>  rdma.c |    5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> --- a/drivers/nvme/target/rdma.c
> +++ b/drivers/nvme/target/rdma.c
> @@ -1438,10 +1438,7 @@ static int nvmet_rdma_add_port(struct nv
>  	mutex_unlock(&nvmet_rdma_ports_mutex);
>  
>  	rdma_port = nvmet_rdma_listen_cmid(pb);
> -	if (IS_ERR(rdma_port))
> -		return PTR_ERR(rdma_port);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(rdma_port);
>  }
>  

Applied.  Thanks Fengguang!

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -1438,10 +1438,7 @@  static int nvmet_rdma_add_port(struct nv
 	mutex_unlock(&nvmet_rdma_ports_mutex);
 
 	rdma_port = nvmet_rdma_listen_cmid(pb);
-	if (IS_ERR(rdma_port))
-		return PTR_ERR(rdma_port);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(rdma_port);
 }
 
 static void nvmet_rdma_remove_port(struct nvmet_port_binding *pb)