io_u: Using initialized local variable
authorErwan Velu <erwan.velu@enovance.com>
Wed, 2 Apr 2014 08:51:16 +0000 (10:51 +0200)
committerErwan Velu <erwan.velu@enovance.com>
Wed, 2 Apr 2014 08:53:31 +0000 (10:53 +0200)
ddir was feed with io_u->ddir at init time but didn't got used before
reassign it to the same value or another one.

That was making this init useless.

This patch simplify this portion of code by using the initialized
variable.

io_u.c

diff --git a/io_u.c b/io_u.c
index 2f6aecf2bbf5c7710d99772934e32183a5c4fb89..411da3249796987d698e475380824022dca6d12d 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -426,12 +426,10 @@ static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u,
        unsigned int minbs, maxbs;
        unsigned long r, rand_max;
 
        unsigned int minbs, maxbs;
        unsigned long r, rand_max;
 
-       assert(ddir_rw(io_u->ddir));
+       assert(ddir_rw(ddir));
 
        if (td->o.bs_is_seq_rand)
                ddir = is_random ? DDIR_WRITE: DDIR_READ;
 
        if (td->o.bs_is_seq_rand)
                ddir = is_random ? DDIR_WRITE: DDIR_READ;
-       else
-               ddir = io_u->ddir;
 
        minbs = td->o.min_bs[ddir];
        maxbs = td->o.max_bs[ddir];
 
        minbs = td->o.min_bs[ddir];
        maxbs = td->o.max_bs[ddir];