linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PACTH net-next] SUNRPC: remove an unnecessary if statement
@ 2013-10-15  3:44 wangweidong
  0 siblings, 0 replies; 3+ messages in thread
From: wangweidong @ 2013-10-15  3:44 UTC (permalink / raw)
  To: davem, Trond.Myklebust, bfields
  Cc: netdev, linux-nfs, linux-kernel, dingtianhong

If req allocated failed just goto out_free, no need to check the
'i < num_prealloc'. There is just code simplification, no
functional changes.

Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
---
 net/sunrpc/xprt.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 095363e..a8e20de 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -1087,11 +1087,9 @@ struct rpc_xprt *xprt_alloc(struct net *net, size_t size,
 	for (i = 0; i < num_prealloc; i++) {
 		req = kzalloc(sizeof(struct rpc_rqst), GFP_KERNEL);
 		if (!req)
-			break;
+			goto out_free;
 		list_add(&req->rq_list, &xprt->free);
 	}
-	if (i < num_prealloc)
-		goto out_free;
 	if (max_alloc > num_prealloc)
 		xprt->max_reqs = max_alloc;
 	else
-- 1.7.12



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

* [PACTH net-next] SUNRPC: remove an unnecessary if statement
@ 2013-10-24  2:35 wangweidong
  2013-10-24 12:29 ` Ding Tianhong
  0 siblings, 1 reply; 3+ messages in thread
From: wangweidong @ 2013-10-24  2:35 UTC (permalink / raw)
  To: davem, Trond.Myklebust, bfields; +Cc: dingtianhong, netdev, linux-nfs

If req allocated failed just goto out_free, no need to check the
'i < num_prealloc'. There is just code simplification, no
functional changes.

Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
---
 net/sunrpc/xprt.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 095363e..a8e20de 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -1087,11 +1087,9 @@ struct rpc_xprt *xprt_alloc(struct net *net, size_t size,
 	for (i = 0; i < num_prealloc; i++) {
 		req = kzalloc(sizeof(struct rpc_rqst), GFP_KERNEL);
 		if (!req)
-			break;
+			goto out_free;
 		list_add(&req->rq_list, &xprt->free);
 	}
-	if (i < num_prealloc)
-		goto out_free;
 	if (max_alloc > num_prealloc)
 		xprt->max_reqs = max_alloc;
 	else
-- 1.7.12




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

* Re: [PACTH net-next] SUNRPC: remove an unnecessary if statement
  2013-10-24  2:35 [PACTH net-next] SUNRPC: remove an unnecessary if statement wangweidong
@ 2013-10-24 12:29 ` Ding Tianhong
  0 siblings, 0 replies; 3+ messages in thread
From: Ding Tianhong @ 2013-10-24 12:29 UTC (permalink / raw)
  To: wangweidong; +Cc: davem, Trond.Myklebust, bfields, netdev, linux-nfs

On 2013/10/24 10:35, wangweidong wrote:
> If req allocated failed just goto out_free, no need to check the
> 'i < num_prealloc'. There is just code simplification, no
> functional changes.
> 
> Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
> ---
>  net/sunrpc/xprt.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
> index 095363e..a8e20de 100644
> --- a/net/sunrpc/xprt.c
> +++ b/net/sunrpc/xprt.c
> @@ -1087,11 +1087,9 @@ struct rpc_xprt *xprt_alloc(struct net *net, size_t size,
>  	for (i = 0; i < num_prealloc; i++) {
>  		req = kzalloc(sizeof(struct rpc_rqst), GFP_KERNEL);
>  		if (!req)
> -			break;
> +			goto out_free;
>  		list_add(&req->rq_list, &xprt->free);
>  	}
> -	if (i < num_prealloc)
> -		goto out_free;
>  	if (max_alloc > num_prealloc)
>  		xprt->max_reqs = max_alloc;
>  	else
> -- 1.7.12
> 
> 

Acked-by: Ding Tianhong <dingtianhong@huawei.com>

> 
> 
> .
> 



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

end of thread, other threads:[~2013-10-24 12:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-24  2:35 [PACTH net-next] SUNRPC: remove an unnecessary if statement wangweidong
2013-10-24 12:29 ` Ding Tianhong
  -- strict thread matches above, loose matches on Subject: below --
2013-10-15  3:44 wangweidong

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).