]> git.itanic.dy.fi Git - linux-stable/commitdiff
dccp: Fix compile warning in probe code.
authorDavid S. Miller <davem@davemloft.net>
Thu, 1 Dec 2011 19:45:49 +0000 (14:45 -0500)
committerWilly Tarreau <w@1wt.eu>
Fri, 18 Sep 2015 11:52:18 +0000 (13:52 +0200)
commit d984e6197ecd2babc1537f42dc1e676133005cda upstream.

Commit 1386be55e32a3c5d8ef4a2b243c530a7b664c02c ("dccp: fix
auto-loading of dccp(_probe)") fixed a bug but created a new
compiler warning:

net/dccp/probe.c: In function â\80\98dccpprobe_initâ\80\99:
net/dccp/probe.c:166:2: warning: the omitted middle operand in ?: will always be â\80\98trueâ\80\99, 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>
Signed-off-by: Willy Tarreau <w@1wt.eu>
net/dccp/probe.c

index 3ba43b8c7617b0e2a4cbc3cb6ac07cc5cf42fc88..89f25cb95603d00cd1eded7a96d36a250e8c0930 100644 (file)
@@ -151,6 +151,17 @@ static const struct file_operations dccpprobe_fops = {
        .read    = dccpprobe_read,
 };
 
+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;
@@ -164,8 +175,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;