All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wang Weidong <wangweidong1@huawei.com>
To: dccp@vger.kernel.org
Subject: Re: [PATCH 1/1][net-next] dccp: catch failed request_module call in dccp_probe init
Date: Wed, 18 Dec 2013 02:38:36 +0000	[thread overview]
Message-ID: <52B10AAC.3070400@huawei.com> (raw)
In-Reply-To: <20131217192433.168b39ef@liptov.cs.ualberta.ca>

On 2013/12/18 10:24, Gerrit Renker wrote:
> Hi Wang,
> 
> thank you for the patch, please find refactored version below, changes are
>  (a) if request_module fails, return its error code instead of the previous ret,
>  (b) refactor code -- setup_jprobe becomes superfluous.
> 
> Please add your signed off if ok, since it is essentially your patch.
> 
>>>>>>>>>>>>>>>>>>>>>>>> Wang's patch revised <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> dccp: catch failed request_module call in dccp_probe init
> 
> Check the return value of request_module during dccp_probe initialisation,
> bail out if that call fails.
> 
> Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
> ---
>  net/dccp/probe.c |   19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)
> 
> --- a/net/dccp/probe.c
> +++ b/net/dccp/probe.c
> @@ -152,17 +152,6 @@ static const struct file_operations dccp
>  	.llseek  = noop_llseek,
>  };
>  
> -static __init int setup_jprobe(void)
> -{
> -	int ret = register_jprobe(&dccp_send_probe);
> -
> -	if (ret) {
> -		request_module("dccp");
> -		ret = register_jprobe(&dccp_send_probe);
> -	}
> -	return ret;
> -}
> -
>  static __init int dccpprobe_init(void)
>  {
>  	int ret = -ENOMEM;
> @@ -174,7 +163,13 @@ static __init int dccpprobe_init(void)
>  	if (!proc_create(procname, S_IRUSR, init_net.proc_net, &dccpprobe_fops))
>  		goto err0;
>  
> -	ret = setup_jprobe();
> +	ret = register_jprobe(&dccp_send_probe);
> +	if (ret) {
> +		ret = request_module("dccp");
> +		if (!ret)
> +			ret = register_jprobe(&dccp_send_probe);
> +	}
> +
>  	if (ret)
>  		goto err1;
>  
> 
> 

It is OK.
Thanks.

Signed-off-by: Wang Weidong <wangweidong1@huawei.com>




WARNING: multiple messages have this Message-ID (diff)
From: Wang Weidong <wangweidong1@huawei.com>
To: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Cc: David Miller <davem@davemloft.net>, <dccp@vger.kernel.org>,
	<netdev@vger.kernel.org>
Subject: Re: [PATCH 1/1][net-next] dccp: catch failed request_module call in dccp_probe init
Date: Wed, 18 Dec 2013 10:38:36 +0800	[thread overview]
Message-ID: <52B10AAC.3070400@huawei.com> (raw)
In-Reply-To: <20131217192433.168b39ef@liptov.cs.ualberta.ca>

On 2013/12/18 10:24, Gerrit Renker wrote:
> Hi Wang,
> 
> thank you for the patch, please find refactored version below, changes are
>  (a) if request_module fails, return its error code instead of the previous ret,
>  (b) refactor code -- setup_jprobe becomes superfluous.
> 
> Please add your signed off if ok, since it is essentially your patch.
> 
>>>>>>>>>>>>>>>>>>>>>>>> Wang's patch revised <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> dccp: catch failed request_module call in dccp_probe init
> 
> Check the return value of request_module during dccp_probe initialisation,
> bail out if that call fails.
> 
> Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
> ---
>  net/dccp/probe.c |   19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)
> 
> --- a/net/dccp/probe.c
> +++ b/net/dccp/probe.c
> @@ -152,17 +152,6 @@ static const struct file_operations dccp
>  	.llseek  = noop_llseek,
>  };
>  
> -static __init int setup_jprobe(void)
> -{
> -	int ret = register_jprobe(&dccp_send_probe);
> -
> -	if (ret) {
> -		request_module("dccp");
> -		ret = register_jprobe(&dccp_send_probe);
> -	}
> -	return ret;
> -}
> -
>  static __init int dccpprobe_init(void)
>  {
>  	int ret = -ENOMEM;
> @@ -174,7 +163,13 @@ static __init int dccpprobe_init(void)
>  	if (!proc_create(procname, S_IRUSR, init_net.proc_net, &dccpprobe_fops))
>  		goto err0;
>  
> -	ret = setup_jprobe();
> +	ret = register_jprobe(&dccp_send_probe);
> +	if (ret) {
> +		ret = request_module("dccp");
> +		if (!ret)
> +			ret = register_jprobe(&dccp_send_probe);
> +	}
> +
>  	if (ret)
>  		goto err1;
>  
> 
> 

It is OK.
Thanks.

Signed-off-by: Wang Weidong <wangweidong1@huawei.com>

  reply	other threads:[~2013-12-18  2:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-18  2:24 [PATCH 1/1][net-next] dccp: catch failed request_module call in dccp_probe init (was: [PATCH net-n Gerrit Renker
2013-12-18  2:24 ` [PATCH 1/1][net-next] dccp: catch failed request_module call in dccp_probe init (was: [PATCH net-next] dccp: add check request_moduls in setup_jprobe) Gerrit Renker
2013-12-18  2:38 ` Wang Weidong [this message]
2013-12-18  2:38   ` [PATCH 1/1][net-next] dccp: catch failed request_module call in dccp_probe init Wang Weidong
2013-12-20  0:26 ` David Miller
2013-12-20  0:26   ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2013-12-17 12:30 [PATCH net-next] dccp: add check request_moduls in setup_jprobe Wang Weidong
2013-12-17 12:30 ` Wang Weidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52B10AAC.3070400@huawei.com \
    --to=wangweidong1@huawei.com \
    --cc=dccp@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.