Skip to content

Commit d984e61

Browse files
committed
dccp: Fix compile warning in probe code.
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>
1 parent 6569861 commit d984e61

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

‎net/dccp/probe.c‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,17 @@ static const struct file_operations dccpprobe_fops = {
152152
.llseek = noop_llseek,
153153
};
154154

155+
static __init int setup_jprobe(void)
156+
{
157+
int ret = register_jprobe(&dccp_send_probe);
158+
159+
if (ret) {
160+
request_module("dccp");
161+
ret = register_jprobe(&dccp_send_probe);
162+
}
163+
return ret;
164+
}
165+
155166
static __init int dccpprobe_init(void)
156167
{
157168
int ret = -ENOMEM;
@@ -163,8 +174,7 @@ static __init int dccpprobe_init(void)
163174
if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &dccpprobe_fops))
164175
goto err0;
165176

166-
try_then_request_module((ret = register_jprobe(&dccp_send_probe)) == 0,
167-
"dccp");
177+
ret = setup_jprobe();
168178
if (ret)
169179
goto err1;
170180

0 commit comments

Comments
 (0)