Commit 3a5352fc authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

staging/mei: Don't check if loop cursor is null

list_for_each_entry_safe(pos, next, &head, list)
	if (pos) {
		....
	}

This check isn't needed.  The list cursor in a list_for_each()
loop is always a valid pointer

Cc: Oren Weil <oren.jer.weil@intel.com>
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 91762057
...@@ -48,11 +48,11 @@ void mei_io_list_init(struct mei_io_list *list) ...@@ -48,11 +48,11 @@ void mei_io_list_init(struct mei_io_list *list)
*/ */
void mei_io_list_flush(struct mei_io_list *list, struct mei_cl *cl) void mei_io_list_flush(struct mei_io_list *list, struct mei_cl *cl)
{ {
struct mei_cl_cb *pos = NULL; struct mei_cl_cb *pos;
struct mei_cl_cb *next = NULL; struct mei_cl_cb *next;
list_for_each_entry_safe(pos, next, &list->mei_cb.cb_list, cb_list) { list_for_each_entry_safe(pos, next, &list->mei_cb.cb_list, cb_list) {
if (pos) { if (pos->file_private) {
struct mei_cl *cl_tmp; struct mei_cl *cl_tmp;
cl_tmp = (struct mei_cl *)pos->file_private; cl_tmp = (struct mei_cl *)pos->file_private;
if (mei_cl_cmp_id(cl, cl_tmp)) if (mei_cl_cmp_id(cl, cl_tmp))
...@@ -332,11 +332,8 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled) ...@@ -332,11 +332,8 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
/* remove all waiting requests */ /* remove all waiting requests */
list_for_each_entry_safe(cb_pos, cb_next, list_for_each_entry_safe(cb_pos, cb_next,
&dev->write_list.mei_cb.cb_list, cb_list) { &dev->write_list.mei_cb.cb_list, cb_list) {
if (cb_pos) {
list_del(&cb_pos->cb_list); list_del(&cb_pos->cb_list);
mei_free_cb_private(cb_pos); mei_free_cb_private(cb_pos);
cb_pos = NULL;
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment