Move path slot assignment before the condition check to prevent
duplicate assignment. Previously, the slot was set both inside and after
the 'slot >= nritems' block with no change in its value, which is
unnecessary.
Signed-off-by: Sun YangKai <sunk67188@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
                 * we didn't find a candidate key in this node, walk forward
                 * and find another one
                 */
+               path->slots[level] = slot;
                if (slot >= nritems) {
-                       path->slots[level] = slot;
                        sret = btrfs_find_next_key(root, path, min_key, level,
                                                  min_trans);
                        if (sret == 0) {
                                goto out;
                        }
                }
-               path->slots[level] = slot;
                if (level == path->lowest_level) {
                        ret = 0;
                        /* Save our key for returning back. */