diff options
author | Julia Lawall <julia@diku.dk> | 2010-08-03 17:34:36 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-31 14:13:15 -0400 |
commit | a3d7fc5ce9f5985ce5230e336f104608835693a1 (patch) | |
tree | 5c198395c5645e34aad7e5a7b95bcdf4a696d660 /drivers/staging/pohmelfs/config.c | |
parent | ace9115712f64315d59a86146103f6f6fc32cde3 (diff) |
staging: Drop unnecessary null test
list_for_each_entry binds its first argument to a non-null value, and thus
any null test on the value of that argument is superfluous.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
iterator I;
expression x;
statement S;
@@
I(x,...) { <...
- if (x != NULL || ...)
S
...> }
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/pohmelfs/config.c')
-rw-r--r-- | drivers/staging/pohmelfs/config.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/drivers/staging/pohmelfs/config.c b/drivers/staging/pohmelfs/config.c index 8c8d1c282e7..89279ba1b73 100644 --- a/drivers/staging/pohmelfs/config.c +++ b/drivers/staging/pohmelfs/config.c | |||
@@ -301,10 +301,8 @@ static int pohmelfs_cn_dump(struct cn_msg *msg) | |||
301 | 301 | ||
302 | mutex_lock(&pohmelfs_config_lock); | 302 | mutex_lock(&pohmelfs_config_lock); |
303 | 303 | ||
304 | list_for_each_entry(g, &pohmelfs_config_list, group_entry) { | 304 | list_for_each_entry(g, &pohmelfs_config_list, group_entry) |
305 | if (g) | 305 | total_msg += g->num_entry; |
306 | total_msg += g->num_entry; | ||
307 | } | ||
308 | if (total_msg == 0) { | 306 | if (total_msg == 0) { |
309 | if (pohmelfs_send_reply(err, 0, POHMELFS_NOINFO_ACK, msg, NULL)) | 307 | if (pohmelfs_send_reply(err, 0, POHMELFS_NOINFO_ACK, msg, NULL)) |
310 | err = -ENOMEM; | 308 | err = -ENOMEM; |
@@ -312,15 +310,16 @@ static int pohmelfs_cn_dump(struct cn_msg *msg) | |||
312 | } | 310 | } |
313 | 311 | ||
314 | list_for_each_entry(g, &pohmelfs_config_list, group_entry) { | 312 | list_for_each_entry(g, &pohmelfs_config_list, group_entry) { |
315 | if (g) { | 313 | list_for_each_entry_safe(c, tmp, &g->config_list, |
316 | list_for_each_entry_safe(c, tmp, &g->config_list, config_entry) { | 314 | config_entry) { |
317 | struct pohmelfs_ctl *sc = &c->state.ctl; | 315 | struct pohmelfs_ctl *sc = &c->state.ctl; |
318 | if (pohmelfs_send_reply(err, total_msg - i, POHMELFS_CTLINFO_ACK, msg, sc)) { | 316 | if (pohmelfs_send_reply(err, total_msg - i, |
319 | err = -ENOMEM; | 317 | POHMELFS_CTLINFO_ACK, msg, |
320 | goto out_unlock; | 318 | sc)) { |
321 | } | 319 | err = -ENOMEM; |
322 | i += 1; | 320 | goto out_unlock; |
323 | } | 321 | } |
322 | i += 1; | ||
324 | } | 323 | } |
325 | } | 324 | } |
326 | 325 | ||
@@ -354,12 +353,11 @@ static int pohmelfs_cn_flush(struct cn_msg *msg) | |||
354 | } | 353 | } |
355 | } else { | 354 | } else { |
356 | list_for_each_entry(g, &pohmelfs_config_list, group_entry) { | 355 | list_for_each_entry(g, &pohmelfs_config_list, group_entry) { |
357 | if (g) { | 356 | list_for_each_entry_safe(c, tmp, &g->config_list, |
358 | list_for_each_entry_safe(c, tmp, &g->config_list, config_entry) { | 357 | config_entry) { |
359 | list_del(&c->config_entry); | 358 | list_del(&c->config_entry); |
360 | g->num_entry--; | 359 | g->num_entry--; |
361 | kfree(c); | 360 | kfree(c); |
362 | } | ||
363 | } | 361 | } |
364 | } | 362 | } |
365 | } | 363 | } |