btrfs: cleanup find_device() drop list_head pointer
authorAnand Jain <anand.jain@oracle.com>
Thu, 12 Apr 2018 02:29:29 +0000 (10:29 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 28 May 2018 16:07:22 +0000 (18:07 +0200)
find_device() declares struct list_head *head pointer and used only once,
instead just use it directly.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c

index 6a78ae24f68abcb2a88f79e8a457cb9033acd739..bae1d2a7b2329f31a9491e3a957ddf985ce7d42b 100644 (file)
@@ -362,10 +362,9 @@ static struct btrfs_device *__alloc_device(void)
 static struct btrfs_device *find_device(struct btrfs_fs_devices *fs_devices,
                u64 devid, const u8 *uuid)
 {
 static struct btrfs_device *find_device(struct btrfs_fs_devices *fs_devices,
                u64 devid, const u8 *uuid)
 {
-       struct list_head *head = &fs_devices->devices;
        struct btrfs_device *dev;
 
        struct btrfs_device *dev;
 
-       list_for_each_entry(dev, head, dev_list) {
+       list_for_each_entry(dev, &fs_devices->devices, dev_list) {
                if (dev->devid == devid &&
                    (!uuid || !memcmp(dev->uuid, uuid, BTRFS_UUID_SIZE))) {
                        return dev;
                if (dev->devid == devid &&
                    (!uuid || !memcmp(dev->uuid, uuid, BTRFS_UUID_SIZE))) {
                        return dev;