[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190204150132.GM31132@infradead.org>
Date: Mon, 4 Feb 2019 07:01:32 -0800
From: Christoph Hellwig <hch@...radead.org>
To: David Kozub <zub@...ux.fjfi.cvut.cz>
Cc: Jens Axboe <axboe@...nel.dk>,
Jonathan Derrick <jonathan.derrick@...el.com>,
Scott Bauer <sbauer@...donthack.me>,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
Jonas Rabenstein <jonas.rabenstein@...dium.uni-erlangen.de>
Subject: Re: [PATCH v4 15/16] block: sed-opal: don't repeat opal_discovery0
in each steps array
> + /* first do a discovery0 */
> + error = opal_discovery0_step(dev);
>
> + for (state = 0; !error && state < n_steps; state++)
> + error = execute_step(dev, &steps[state], state);
> +
> + /*
> + * For each OPAL command the first step in steps starts some sort of
> + * session. If an error occurred in the initial discovery0 or if an
> + * error occurred in the first step (and thus stopping the loop with
> + * state == 1) then there was an error before or during the attempt to
> + * start a session. Therefore we shouldn't attempt to terminate a
> + * session, as one has not yet been created.
> + */
> + if (error && state > 1)
> + end_opal_session_error(dev);
>
> return error;
The flow here is a little too condensed for my taste. Why not the
plain obvoious, if a little longer:
error = error = opal_discovery0_step(dev);
if (error)
return error;
for (state = 0; state < n_steps; state++) {
error = execute_step(dev, &steps[state], state);
if (error)
goto out_error;
}
return 0;
out_error:
if (state > 1)
end_opal_session_error(dev);
return error;
Otherwise looks good:
Reviewed-by: Christoph Hellwig <hch@....de>
Powered by blists - more mailing lists