Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3d7fc5c authored by Julia Lawall's avatar Julia Lawall Committed by Greg Kroah-Hartman
Browse files

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: default avatarJulia Lawall <julia@diku.dk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ace91157
Loading
Loading
Loading
Loading
+16 −18
Original line number Diff line number Diff line
@@ -301,10 +301,8 @@ static int pohmelfs_cn_dump(struct cn_msg *msg)

	mutex_lock(&pohmelfs_config_lock);

	list_for_each_entry(g, &pohmelfs_config_list, group_entry) {
		if (g)
	list_for_each_entry(g, &pohmelfs_config_list, group_entry)
		total_msg += g->num_entry;
	}
	if (total_msg == 0) {
		if (pohmelfs_send_reply(err, 0, POHMELFS_NOINFO_ACK, msg, NULL))
			err = -ENOMEM;
@@ -312,17 +310,18 @@ static int pohmelfs_cn_dump(struct cn_msg *msg)
	}

	list_for_each_entry(g, &pohmelfs_config_list, group_entry) {
		if (g) {
			list_for_each_entry_safe(c, tmp, &g->config_list, config_entry) {
		list_for_each_entry_safe(c, tmp, &g->config_list,
					 config_entry) {
			struct pohmelfs_ctl *sc = &c->state.ctl;
				if (pohmelfs_send_reply(err, total_msg - i, POHMELFS_CTLINFO_ACK, msg, sc)) {
			if (pohmelfs_send_reply(err, total_msg - i,
						POHMELFS_CTLINFO_ACK, msg,
						sc)) {
				err = -ENOMEM;
				goto out_unlock;
			}
			i += 1;
		}
	}
	}

out_unlock:
	mutex_unlock(&pohmelfs_config_lock);
@@ -354,15 +353,14 @@ static int pohmelfs_cn_flush(struct cn_msg *msg)
		}
	} else {
		list_for_each_entry(g, &pohmelfs_config_list, group_entry) {
			if (g) {
				list_for_each_entry_safe(c, tmp, &g->config_list, config_entry) {
			list_for_each_entry_safe(c, tmp, &g->config_list,
						 config_entry) {
				list_del(&c->config_entry);
				g->num_entry--;
				kfree(c);
			}
		}
	}
	}

out_unlock:
	mutex_unlock(&pohmelfs_config_lock);
+2 −4
Original line number Diff line number Diff line
@@ -702,10 +702,8 @@ void tm6000_unregister_extension(struct tm6000_ops *ops)
	struct tm6000_core *dev = NULL;

	mutex_lock(&tm6000_devlist_mutex);
	list_for_each_entry(dev, &tm6000_devlist, devlist) {
		if (dev)
	list_for_each_entry(dev, &tm6000_devlist, devlist)
		ops->fini(dev);
	}

	mutex_lock(&tm6000_extension_devlist_lock);
	printk(KERN_INFO "tm6000: Remove (%s) extension\n", ops->name);