Skip to content

Commit

Permalink
dccp: Fix compile warning in probe code.
Browse files Browse the repository at this point in the history
Commit 1386be5 ("dccp: fix
auto-loading of dccp(_probe)") fixed a bug but created a new
compiler warning:

net/dccp/probe.c: In function ‘dccpprobe_init’:
net/dccp/probe.c:166:2: warning: the omitted middle operand in ?: will always be ‘true’, suggest explicit middle operand [-Wparentheses]

try_then_request_module() is built for situations where the
"existence" test is some lookup function that returns a non-NULL
object on success, and with a reference count of some kind held.

Here we're looking for a success return of zero from the jprobe
registry.

Instead of fighting the way try_then_request_module() works, simply
open code what we want to happen in a local helper function.

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Dec 1, 2011
1 parent 6569861 commit d984e61
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions net/dccp/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,17 @@ static const struct file_operations dccpprobe_fops = {
.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;
Expand All @@ -163,8 +174,7 @@ static __init int dccpprobe_init(void)
if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &dccpprobe_fops))
goto err0;

try_then_request_module((ret = register_jprobe(&dccp_send_probe)) == 0,
"dccp");
ret = setup_jprobe();
if (ret)
goto err1;

Expand Down

0 comments on commit d984e61

Please sign in to comment.