Skip to content

Commit cd59cde

Browse files
Jinjie Ruanidryomov
authored andcommitted
rbd: use list_for_each_entry() helper
Convert list_for_each() to list_for_each_entry() so that the tmp list_head pointer and list_entry() call are no longer needed, which can reduce a few lines of code. No functional changed. Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent e6a28d6 commit cd59cde

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/block/rbd.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7199,7 +7199,6 @@ static void rbd_dev_remove_parent(struct rbd_device *rbd_dev)
71997199
static ssize_t do_rbd_remove(const char *buf, size_t count)
72007200
{
72017201
struct rbd_device *rbd_dev = NULL;
7202-
struct list_head *tmp;
72037202
int dev_id;
72047203
char opt_buf[6];
72057204
bool force = false;
@@ -7226,8 +7225,7 @@ static ssize_t do_rbd_remove(const char *buf, size_t count)
72267225

72277226
ret = -ENOENT;
72287227
spin_lock(&rbd_dev_list_lock);
7229-
list_for_each(tmp, &rbd_dev_list) {
7230-
rbd_dev = list_entry(tmp, struct rbd_device, node);
7228+
list_for_each_entry(rbd_dev, &rbd_dev_list, node) {
72317229
if (rbd_dev->dev_id == dev_id) {
72327230
ret = 0;
72337231
break;

0 commit comments

Comments
 (0)